Skip to content

适用虚谷数据库版本

v12.9



适用虚谷数据库版本

v12.9


环境与系统配置检查

📄字数 3.7K
👁️阅读量 加载中...

一、硬件检查

1.1 磁盘

查看文件系统的磁盘空间使用情况:

sh
[xugu@node1 ~]$ df -h
文件系统              容量  已用  可用    已用%  挂载点
/dev/nvme0n1p1       2.0T   1.1T  1014G   51%    /PublicDS

数据盘8k写入速度测试:

sh
[root@node1 ~]# dd bs=8k count=4k if=/dev/zero of=test01 oflag=dsync
记录了4096+0 的读入
记录了4096+0 的写出
33554432字节(34 MB)已复制,6.15086 秒,5.5 MB/秒

提示

物理机与虚拟机环境建议8K块的纯写速度最低要求达到10MB/秒及以上,云环境部署建议纯写速度在3.5M/秒。

1.2 网络

  • 查看网卡详细信息
sh
[xugu@node1 ~]$ ethtool enp189s0f0
  • 节点间延迟检查
sh
[xugu@node1 ~]$ ping 10.28.20.151
PING 10.28.20.151 (10.28.20.151) 56(84) bytes of data.
64 bytes from 10.28.20.151: icmp_seq=1 ttl=64 time=0.128 ms
64 bytes from 10.28.20.151: icmp_seq=2 ttl=64 time=0.085 ms
--- 10.28.20.151 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1055ms
rtt min/avg/max/mdev = 0.085/0.106/0.128/0.021 ms
  • 节点间丢包率检查
sh
[root@node1 ~]$# ping -s 10240 192.168.1.13 -c 50000 -f
PING 192.168.1.13 (192.168.1.13) 10240(10268) bytes of data.
--- 192.168.1.13 ping statistics ---
28837 packets transmitted, 28837 received, 0% packet loss, time 1871ms
rtt min/avg/max/mdev = 0.006/0.024/6.617/0.082 ms, ipg/ewma 0.064/0.014 ms

提示

  1. 网卡最低配置,单机和双机要求数据交换网络要求千兆网络及以上,分布式要求为万兆交换网络及以上。
  2. 集群内部数据交换网络节点之间互ping,万兆网时延不高于0.06ms,千兆网时延不高于0.1ms,丢包率为0。
  • 设置网络相关内核参数
sh
-- 1. 修改配置文件
[xugu@node1 ~]$ vim /etc/sysctl.conf
net.core.rmem_default = 20971520
net.core.wmem_default = 20971520
net.core.rmem_max = 83886080
net.core.wmem_max = 83886080

-- 2. 使配置文件立即生效
[xugu@node1 ~]$ sysctl -p /etc/sysctl.conf

1.3 (可选)防火墙

防火墙设置有如下两种方式,根据实际情况进行调整。

1.3.1 永久关闭防火墙

sh
[xugu@node1 ~]$ systemctl stop firewalld.service
[xugu@node1 ~]$ systemctl disable firewalld.service

1.3.2 添加端口策略

根据实际情况添加端口,数据库监听端口、节点间UDP通信端口、监控工具监听端口等,示例为防火墙添加数据库监听端口:

sh
[xugu@node1 ~]$ firewall-cmd --zone=public --add-port=5138/tcp  --permanent
[xugu@node1 ~]$ firewall-cmd --reload
[xugu@node1 ~]$ firewall-cmd --zone=public --list-ports

二、软件检查

2.1 检查端口

检查预设端口是否已被占用(TCP默认5138,UDP端口通过cluster.ini确认),无信息返回则未被占用;返回信息则被占用,请更换端口

sh
[xugu@node1 ~]$ netstat -anp |grep 5138

提示

cluster.ini文件中的UDP端口是接收端口,检查时还需检查发送端口,发送端口=接收端口+20。

2.2 (可选)关闭 SELinux

  • 获取当前状态
sh
[xugu@node1 ~]$ getenforce
Disabled
  • 临时关闭selinux
sh
[xugu@node1 ~]$ setenforce 0
setenforce: SELinux is disabled
  • 永久关闭SELinux
sh
[root@node1 ~]$ vim /etc/selinux/config

将文件中 SELINUX=enforcing 改为SELINUX=disabled,保存该文件后重启操作系统

sh
[xugu@node1 ~]$ cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX=disabled
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     ukmls - Multi Level Security protection.
#     ukmcs -ukmcs variants of the SELinux policy.
SELINUXTYPE=targeted

2.3 (可选)时间同步配置

注意:若用户已存在时钟同步服务器情况,可直接通过ntp方式配置时钟同步,可跳过后续时钟同步服务器配置。

  • 服务端配置
sh
[root@node1 ~]# vim /etc/chrony.conf
# Allow NTP client access from local network.
allow 192.168.1.0/16  #配置允许访问的客户端服务列表

# Serve time even if not synchronized to a time source.
local stratum 10 #打开注释设置同步
  • 重启chrony服务
sh
[root@node1 ~]# systemctl restart chronyd.service
  • 客户端配置
sh
[root@node1 ~]# vim /etc/chrony.conf
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.1.12 iburst  #添加服务端的ip地址
  • 重启chrony服务
sh
[root@node1 ~]# systemctl restart chronyd.service
  • 启动同步
sh
[root@node1 ~]# chronyc sources -v

2.4 互信认证

  • 节点1生成密钥
sh
[xugu@node1 ~]# ssh-keygen -t rsa
  • 节点1生成的密钥发送到节点2
sh
[xugu@node1 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub xugu@192.168.1.13
  • 验证
sh
[xugu@node1 ~]# ssh xugu@192.168.1.13

2.5 (可选)配置 limits.conf

通过配置 limits.conf 限制进程数量。

个人用户可跳过此步骤,企业用户建议配置 limits.conf。

通过配置文件/etc/security/limits.conf 在全局级别修改。

XuguDB 的进程涉及的限制包括线程最大栈空间大小(Stack)和最大文件句柄数(Open Files)。

2.5.1 更改配置

注意

必须在每台机器上分别执行此操作

  • 检查open files和stack size
sh
[xugu@node1 ~]# ulimit -a|grep -e "open files" -e "stack size"
open files                      (-n) 10240
stack size              (kbytes, -s) 20480

若不满足以上配置则执行以下命令打开/etc/security/limits.conf 配置文件:

sh
vim /etc/security/limits.conf

在配置文件中添加以下内容:

sh
xugu soft open files 10240
xugu soft stack size 20480

查看配置是否生效

sh
ulimit -a

输出如下:

sh
[xugu@node1 ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 2060234
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 10240
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 20480
cpu time               (seconds, -t) unlimited
max user processes              (-u) 2060234
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

2.6 (可选)主机名配置

根据规划配置主机名:

sh
[root@node1 ~]# hostnamectl set-hostname xugu01
[root@node1 ~]# vim /etc/hosts
xugu01 xxx.xxx.xxx.xxx
xugu02 xxx.xxx.xxx.xxx
xugu03 xxx.xxx.xxx.xxx
xugu04 xxx.xxx.xxx.xxx