MySQL local 連 remote 時,
要關閉 SELinux 或設定才能連線
PHP upgrade always breaks session folder permissions
PHP 升級後都會自動改成 session owner 回原本設定,
網路建議是為 owner 另建子資料夾對應, 下次就不會被更動.
user = nginx
; Set session path to a directory owned by process user
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/nginx/session
php_value[soap.wsdl_cache_dir] = /var/lib/php/nginx/wsdlcache
ref: https://serverfault.com/questions/582483/php-upgrade-always-breaks-session-folder-permissions
網路建議是為 owner 另建子資料夾對應, 下次就不會被更動.
user = nginx
; Set session path to a directory owned by process user
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/nginx/session
php_value[soap.wsdl_cache_dir] = /var/lib/php/nginx/wsdlcache
ref: https://serverfault.com/questions/582483/php-upgrade-always-breaks-session-folder-permissions
MariaDB Max connect
參考
https://pjstrnad.com/mariadb-raise-number-of-connections/
https://pjstrnad.com/mariadb-raise-number-of-connections/
The issue is that you can’t have more max_connections than open_files_limit.
Indication is at the log
Changed limits: max_open_files: 1024 max_connections: 214 table_cache: 400
So you got to /etc/my.cnf and under [mysqld] add
open_files_limit=12000 max_connections=10000
But it’s not enough. Because of the systemd there are some limits in starting the mysql server – it’s already started with mysql user.
So you need to go to /etc/security/limits.conf and add
mysql soft nofile 4096 mysql hard nofile 10240
Then settings for systemd
mkdir -p /etc/systemd/system/mariadb.service.d vi /etc/systemd/system/mariadb.service.d/limits.conf
And then enter this to to the file:
[Service] LimitNOFILE=infinity
that worked to me. After restart of the mysql by
systemctl daemon-reload
systemctl restart mariadb
I got the connections fixed:
mysql MariaDB [(none)]> select @@max_connections; +-------------------+ | @@max_connections | +-------------------+ | 10000 | +-------------------+ MariaDB [(none)]> SHOW VARIABLES LIKE 'open%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | open_files_limit | 65536 | +------------------+-------+
That’s all.
mysql binlog too large
檢查硬碟空間
df -h
檢查資料夾大小
du -sh /home/james/*
MySQL log 太大
設定
/etc/my.cnf
只保留七天的 Log
[mysqld]
expire-logs-days=7
重啟 mysql
systemctl restart mariadb
進入 mysql
mysql -u root -p
刷新 log
FLUSH LOGS;
檢查目前 log 在哪個位置
SHOW MASTER STATUS;
清除指定時間 log
PURGE BINARY LOGS BEFORE NOW();
或清指定的 log 檔
PURGE BINARY LOGS TO 'mysql-bin.000047';
df -h
檢查資料夾大小
du -sh /home/james/*
MySQL log 太大
設定
/etc/my.cnf
只保留七天的 Log
[mysqld]
expire-logs-days=7
重啟 mysql
systemctl restart mariadb
進入 mysql
mysql -u root -p
刷新 log
FLUSH LOGS;
檢查目前 log 在哪個位置
SHOW MASTER STATUS;
清除指定時間 log
PURGE BINARY LOGS BEFORE NOW();
或清指定的 log 檔
PURGE BINARY LOGS TO 'mysql-bin.000047';
MariaDB max_connections, table_open_cache stuck
copy my-hugh.cnf to /etc/my.cnf.d/
editing
/etc/sysctl.conf
fs.file-max = 2459688
editing
/etc/security/limits.conf
mysql soft nofile 4096
mysql hard nofile 4096
editing
/etc/my.cnf.d/my-hugh.cnf
max_connections=1024
max_user_connections=1024
table_open_cache = 4096
table_definition_cache = 4096
open_files_limit=4096
ref:
https://codepoets.co.uk/2015/mysql-max_connections-stuck-on-214/
http://blog.endpoint.com/2013/12/increasing-mysql-55-maxconnections-on.html
editing
/etc/sysctl.conf
fs.file-max = 2459688
editing
/etc/security/limits.conf
mysql soft nofile 4096
mysql hard nofile 4096
editing
/etc/my.cnf.d/my-hugh.cnf
max_connections=1024
max_user_connections=1024
table_open_cache = 4096
table_definition_cache = 4096
open_files_limit=4096
ref:
https://codepoets.co.uk/2015/mysql-max_connections-stuck-on-214/
http://blog.endpoint.com/2013/12/increasing-mysql-55-maxconnections-on.html
GeoIP Update
系統
CentOS
https://github.com/maxmind/geoipupdate
先到官方 git clone
使用 bootstrap 遇到問題要裝以下幾項
執行並安裝
可能會遇到錯誤, curl, zlib 安裝
設定下載參數
http://dev.maxmind.com/geoip/geoipupdate/
照上方步驟安裝完 geoipupdate 後會自動寫一份 config 到
修改這份 config 並 mark 原本設定
然後手動新增資料夾
第一次執行 geoipupdate
檔案會寫入
設定排程 /etc/crontab
CentOS
https://github.com/maxmind/geoipupdate
先到官方 git clone
$ git clone https://github.com/maxmind/geoipupdate
$ cd geoipupdate
$ ./bootstrap使用 bootstrap 遇到問題要裝以下幾項
yum install autoconf automake libtool執行並安裝
$ ./configure
$ make
$ sudo make install
可能會遇到錯誤, curl, zlib 安裝
yum install curl-devel zlib-devel
設定下載參數
http://dev.maxmind.com/geoip/geoipupdate/
照上方步驟安裝完 geoipupdate 後會自動寫一份 config 到
/usr/local/etc/GeoIP.conf修改這份 config 並 mark 原本設定
UserId XXX
LicenseKey XXX
ProductIds GeoIP2-City GeoIP2-Country
然後手動新增資料夾
/usr/local/share/GeoIP第一次執行 geoipupdate
檔案會寫入
/usr/local/share/GeoIP設定排程 /etc/crontab
52 11 * * 6 /usr/local/bin/geoipupdate
訂閱:
文章 (Atom)