您好,登錄后才能下訂單哦!
關閉 numa=off ,修改磁盤IO調度方式 elevator=deadline
修改方法:
grubby --update-kernel=ALL --args="transparent_hugepage=never" --args="elevator=deadline"
驗證:
grubby --info=ALL
返回
args="ro crashkernel=auto rhgb quiet numa=off elevator=deadline"
驗證是否開啟方法1:
如果以下文件不存在,則是THP已經從內核中移除。
/sys/kernel/mm/transparent_hugepage or /sys/kernel/mm/redhat_transparent_hugepage
驗證是否開啟方法2:
cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
[always] == 》表示開啟
修改 /etc/rc.local
# vi /etc/rc.local #追加,禁用大頁
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
vi /etc/sysctl.conf
添加內容如下:
vm.swappiness = 0
kernel.shmmax=135497418752
net.core.rmem_max = 4194304
net.core.wmem_max = 4194304
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.ipv4.ip_local_port_range = 9000 65535
kernel.sem = 50100 64128000 50100 1280
vm.dirty_background_bytes = 102400000
vm.dirty_ratio = 80
vm.nr_hugepages = 102352
/etc/security/limits.conf
* soft nofile 655360
* hard nofile 655360
* soft nproc 655360
* hard nproc 655360
* soft stack unlimited
* hard stack unlimited
* soft memlock 250000000
* hard memlock 250000000
blockdev --setra 16384 /dev/sda
設置開機啟動生效:
echo "blockdev --setra 16384 /dev/sda" >> /etc/rc.local
ALTER SYSTEM SET configuration_parameter { TO | = } { value | 'value' | DEFAULT }
Case:
alter system set max_connections='50';
Case:
show max_connections
調用該命令的用戶必須具有超級用戶權限。修改系統配置文件postgresql.conf,通過系統信號,重新加載該配置文件.
select name, context,setting,unit,source,sourcefile from pg_settings;
internal: 編譯期間的設置,只有重新編譯才能生效。
postmaster: 只有服務重啟才能生效。
sighup: 給服務器發送HUP信號會是服務器重新加載postgresql.conf配置,可以立即生效。
backend: 與sighup類似,但是不影響正在運行的會話,只在新會話中生效
superuser: 使用superuser(如postgres)才能更改,不用重新加載所有配置即可生效。
user: 單個會話用戶可以在任意時間做修改,只會影響該會話。
more /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
uname -a
Linux jp33e506-3-22.ptengine.com 3.10.0-862.2.3.el7.x86_64 #1 SMP Wed May 9 18:05:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Mem: 128763
alter system set max_connections='50';
alter system set shared_buffers='30GB';
alter system set wal_buffers='64MB';
alter system set checkpoint_completion_target='0.9';
alter system set checkpoint_timeout='15min';
alter system set fsync='off';
alter system set commit_delay='10';
alter system set autovacuum_work_mem='1GB';
alter system set commit_siblings='6';
alter system set effective_cache_size='50GB';
alter system set maintenance_work_mem='1GB';
alter system set work_mem='16MB';
show max_connections;
show shared_buffers;
show wal_buffers;
show checkpoint_completion_target;
show checkpoint_timeout;
show fsync;
show commit_delay;
show autovacuum_work_mem;
show commit_siblings;
show effective_cache_size;
show maintenance_work_mem;
show work_mem;
部分優化項重啟后才能生效:
1.用超級用戶運行
postgres=#
SELECT pg_reload_conf();
2.用UNIX的kill手動發起HUP信號
$kill -HUP PID
3.使用pg_ctl命令觸發SIGHUP信號
$pg_ctl reload
或者
systemctl reload postgresql-11.service
systemctl restart postgresql-11.service
systemctl status postgresql-11.service
綠線為分界線
https://www.kancloud.cn/taobaomysql/monthly/140098
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。