当前位置: 首页 > news >正文

OceanBase 初探学习历程之二——操作系统参数最佳实践

        本文章分享OB操作系统参数最佳实践值,相关参数部分来自PK项目得知,仅供参考,实际参数设置仍需结合现有设备条件及业务系统特点是否有必要如此设置,但我任务大部分场景均可用(仅本人个人观点)。

1、磁盘配置

[root@ob2 ~]# cat /etc/fstab 
#
# /etc/fstab
# Created by anaconda on Thu Aug 18 09:03:09 2022
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/uos-root    /                       ext4    defaults        1 1
UUID=ada6bb64-387c-4526-b525-73f897c9ceba /boot                   ext4    defaults        1 2
UUID=0493-3126          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
/dev/mapper/uos-home    /home                   ext4    defaults        1 2
/dev/vgob/log    /data/log1    ext4    defaults,noatime,nodiratime,nodelalloc,barrier=0  0 0
/dev/vgob/data    /data/1   ext4    defaults,noatime,nodiratime,nodelalloc,barrier=0  0 0
/dev/vgob/admin    /home/admin   ext4    defaults,noatime,nodiratime,nodelalloc,barrier=0  0 0

2、文件限制配置

[root@ob2 ~]# more /etc/security/limits.d/oceanbase_limits.conf
*   soft    nofile  655360
*   hard    nofile  655360
*   soft    nproc   655360
*   hard    nproc   655360
*   hard    core    unlimited
*   soft    core    unlimited
*   hard    stack   10240
*   soft    stack   10240
*   hard    cpu     unlimited
*   soft    cpu     unlimited
root   soft    nofile  655360
root   hard    nofile  655360
root   soft    nproc   655360
root   hard    nproc   655360
root   hard    core    unlimited
root   soft    core    unlimited
root   hard    stack   10240
root   soft    stack   10240
root   hard    cpu     unlimited
root   soft    cpu     unlimited

3、SWAP设置

[root@ob2 ~]# free -gtotal        used        free      shared  buff/cache   available
Mem:            381         340           0           0          40          38
Swap:             0           0           0

4、selinux设置

[root@ob2 ~]# sestatus 
SELinux status:                 disabled

5、内核参数配置

[root@ob2 ~]# cat /etc/sysctl.conf 
kernel.sem = 4096 4194304 32768 1024vm.dirty_ratio = 10
vm.dirty_background_ratio = 5
vm.vfs_cache_pressure = 50
vm.swappiness = 1
net.ipv4.ip_local_port_range = 3500 65535
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
net.ipv4.tcp_wmem = 262144 262144 4194304
net.ipv4.tcp_rmem = 4194304 4194304 6291456
vm.nr_hugepages = 384
####################################################
#  for oceanbase
net.core.somaxconn = 2048
net.core.netdev_max_backlog = 10000
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216net.ipv4.ip_local_port_range = 3500 65535
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_slow_start_after_idle=0
net.ipv4.ip_local_reserved_ports = 62881-63881vm.swappiness = 0
kernel.core_pattern = /data/1/core-%e-%p-%t
vm.min_free_kbytes = 2097152
vm.overcommit_memory = 0fs.aio-max-nr=1048576
vm.max_map_count=655360
vm.nr_hugepages = 0

6、登录设置

[root@ob2 ~]# cat  /etc/pam.d/login
#%PAM-1.0
auth       substack     system-auth
auth       include      postlogin
account    required     pam_nologin.so
account    include      system-auth
password   include      system-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      system-auth
session    include      postlogin
-session   optional     pam_ck_connector.sosession  required  /lib64/security/pam_limits.so
session  required  pam_limits.so

7、透明大页numa设置

[root@ob2 ~]# cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=false
GRUB_TERMINAL_OUTPUT="console"
GRUB_BACKGROUND="/boot/efi/EFI/UnionTech/themes/deepin/background.jpg"
GRUB_THEME="/boot/efi/EFI/UnionTech/themes/deepin/theme.txt"
GRUB_GFXMODE=1152x864,auto
DEEPIN_GFXMODE_NOT_SUPPORTED=2560x1600
GRUB_TERMINAL=gfxterm
LANG=C
GRUB_CMDLINE_LINUX="rd.lvm.lv=uos/root rd.lvm.lv=uos/swap video=VGA-1:640x480-32@60me rhgb console=tty0 crashkernel=1024M,high smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off numa=on"
GRUB_DISABLE_RECOVERY="false"[admin@ob2 ~]$ cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

8、I/O调度模式

BOOT_IMAGE=/vmlinuz-4.19.90-2201.4.0.0135.up1.uel20.aarch64 root=/dev/mapper/uos-root ro rd.lvm.lv=uos/root rd.lvm.lv=uos/swap video=VGA-1:640x480-32@60me rhgb console=tty0 crashkernel=1024M,high smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off numa=on[root@ob2 ~]# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-4.19.90-2201.4.0.0135.up1.uel20.aarch64 root=/dev/mapper/uos-root ro rd.lvm.lv=uos/root rd.lvm.lv=uos/swap video=VGA-1:640x480-32@60me rhgb console=tty0 crashkernel=1024M,high smmu.bypassdev=0x1000:0x17 smmu.bypassdev=0x1000:0x15 video=efifb:off numa=on
[root@ob2 ~]# cat /sys/block/nvme1n1/queue/scheduler 
[none] mq-deadline kyber bfq 

9、挂载点设置

root@ob2 ~]# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0 558.4G  0 disk 
├─sda1         8:1    0     1G  0 part /boot/efi
├─sda2         8:2    0     1G  0 part /boot
└─sda3         8:3    0 556.4G  0 part ├─uos-root 253:0    0    70G  0 lvm  /├─uos-swap 253:1    0     4G  0 lvm  └─uos-home 253:5    0 482.4G  0 lvm  /home
nvme3n1      259:0    0   2.9T  0 disk 
├─vgob-log   253:2    0     2T  0 lvm  /data/log1
├─vgob-data  253:3    0   7.9T  0 lvm  /data/1
└─vgob-admin 253:4    0   500G  0 lvm  /home/admin
nvme0n1      259:1    0   2.9T  0 disk 
├─vgob-log   253:2    0     2T  0 lvm  /data/log1
├─vgob-data  253:3    0   7.9T  0 lvm  /data/1
└─vgob-admin 253:4    0   500G  0 lvm  /home/admin
nvme1n1      259:2    0   2.9T  0 disk 
├─vgob-log   253:2    0     2T  0 lvm  /data/log1
├─vgob-data  253:3    0   7.9T  0 lvm  /data/1
└─vgob-admin 253:4    0   500G  0 lvm  /home/admin
nvme2n1      259:3    0   2.9T  0 disk 
├─vgob-log   253:2    0     2T  0 lvm  /data/log1
├─vgob-data  253:3    0   7.9T  0 lvm  /data/1
└─vgob-admin 253:4    0   500G  0 lvm  /home/admin

10、用户变量配置

[admin@ob2 ~]$ cat .bash_profile export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/admin/oceanbase/lib"
[admin@ob2 ~]$ id admin
uid=500(admin) gid=500(admin) groups=500(admin)

11、服务器性能模式

[admin@ob2 ~]$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor 
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance

12、络配置网卡的接受队列和发送队列

[admin@ob2 ~]$ cat /proc/sys/net/core/netdev_max_backlog 
10000

当然还有硬件层面一些提升的空间,这里暂时先不分享,下一期再分享,欢迎大家关注我,一起学习。

(若重要,处处都是办法;若不重要,比比皆是理由。)

http://www.lryc.cn/news/540547.html

相关文章:

  • 全面指南:使用JMeter进行性能压测与性能优化(中间件压测、数据库压测、分布式集群压测、调优)
  • 《机器学习实战》专栏 No12:项目实战—端到端的机器学习项目Kaggle糖尿病预测
  • 【vue项目中如何实现一段文字跑马灯效果】
  • DeepSeek 细节之 MLA (Multi-head Latent Attention)
  • Python爬虫具体是如何解析商品信息的?
  • lerobot调试记录
  • 【Word转PDF】在线Doc/Docx转换为PDF格式 免费在线转换 功能强大好用
  • Jenkins 配置 Credentials 凭证
  • Datawhale Ollama教程笔记5
  • 小爱音箱连接电脑外放之后,浏览器网页视频暂停播放后,音箱整体没声音问题解决
  • go设置镜像代理
  • Python爬虫系列教程之第十二篇:爬虫异常处理与日志记录
  • 将Google文档导入WordPress:简单实用的几种方法
  • 大白话实战Gateway
  • 深入学习解析:183页可编辑PPT华为市场营销MPR+LTC流程规划方案
  • 【微中子代理踩坑-前端node-sass安装失败】
  • 使用open-webui+deepseek构建本地AI知识库
  • CSS盒模
  • 【开源向量数据库】Milvus简介
  • 机器学习笔记——常用损失函数
  • Nginx--日志(介绍、配置、日志轮转)
  • 2025 vue3面试题汇总,通俗易懂
  • 一周学会Flask3 Python Web开发-Debug模式开启
  • 聚焦于机器人研究,提出 FuSe 方法,通过语言锚定对通用机器人策略进行微调 视觉、触觉、听觉
  • C++ 无锁队列:原理与实现
  • web的分离不分离:前后端分离与不分离全面分析
  • MobileSal:极其高效的RGB-D显著性物体检测模型
  • 【个人总结】1. 开发基础 工作三年的嵌入式常见知识点梳理及开发技术要点(欢迎指正、补充)
  • 硬核技术组合!用 DeepSeek R1、Ollama、Docker、RAGFlow 打造专属本地知识库
  • MySQL官网驱动下载(jar包驱动和ODBC驱动)【详细教程】