AntDB Installation and Deployment Documentation - P2
Tags: database
Published: 2023-07-27 02:10:29

## Linux Environment Configuration
This section describes the configuration of the Linux system before installing AntDB, including user creation, dependency installation, and system parameter adjustment.
**User Configuration**
**_New User Creation_**
Create a new normal user, such as uatadb, on all hosts where AntDB is to be installed (or use an existing normal user). New user reference example.

```
useradd -d /home/uatadb uatadb 
passwd uatadb 
```
**_Configure the user limit parameters_**
Edit the /etc/security/limits.conf file and configure the 

```
antdb user parameters.
antdb soft nproc 65536 
antdb hard nproc 65536 
antdb soft nofile 278528 
antdb hard nofile 278528 
antdb soft stack unlimited 
antdb soft core unlimited 
antdb hard core unlimited 
antdb soft memlock 250000000 
antdb hard memlock 250000000 
```
After saving the file, execute su - antdb to switch to antdb user and execute ulimit -a to check if it takes effect.
**_Configure user sudo privileges_**
If security allows, it is recommended to add sudo privileges to the antdb user. Execute visudo for the root user to edit the interface, find the line where Allow root to run any commands anywhere, and add below the line.

```
antdb ALL=(ALL) ALL 
```
Save the file and exit. su - antdb Switch to the antdb user and execute sudo id. Expect to be prompted for the user password and the output will be:

```
uid=0(root) gid=0(root) groups=0(root) 
```
indicates that sudo privileges were added successfully.
**System parameter adjustment**
**_Turn off the firewall_**
Use the centos 7 operating system as an example：
1. Disable the firewall service.

```
systemctl stop firewalld.service 
```
1. Disable the firewall self-start service.

```
systemctl disable firewalld.service 
```
1. Check the firewall status.

```
systemctl status firewalld.service 
```
**_Shut down numa and tuned_**
Take redhat/centos 7 system as an example.
1. Shut down numa.

```
grubby --update-kernel=ALL --args="numa=off " #this command modifies the following file: 
/etc/grub2.cfg 
grub2-mkconfig 
```
1. Shut down the tuned service.

```
systemctl stop tuned 
systemctl disable tuned 
```
1. Reboot the host after the changes in this way take effect.

```
reboot 
```
1. Verify the cmdline of grub after rebooting.

```
cat /proc/cmdline 
```
1. Check numa

```
numactl --hardware 
```
The expected result is: Available: 1 nodes (0)
**_Turn off Transparent Huge Pages_**
The use of Transparent Huge Pages (THP for short) can cause performance problems, so it is recommended to turn them off.
1. Check the on status of Transparent Huge Pages.

```
cat /sys/kernel/mm/transparent_hugepage/enabled 
```
If the result is [always] madvise never, then Transparent Huge Pages is on and needs to be turned off; if the result is always madvise [never], then Transparent Huge Pages is off and this step is skipped; 2. Turn off Transparent Huge Pages.

```
echo never > /sys/kernel/mm/transparent_hugepage/enabled 
echo never > /sys/kernel/mm/transparent_hugepage/defrag checks the on status of Transparent Huge Pages 
```
1. Check again that the Transparent Big Page is on.

```
cat /sys/kernel/mm/transparent_hugepage/enabled 
```
**_Configure sysctl.conf_**
1. Modify the sysctl.conf file.

```
cat >> /etc/sysctl.conf << EOF 
# add for antdb 
kernel.shmmax=137438953472 137438953472 
kernel.shmall=53689091 
kernel.shmmni=4096 
kernel.msgmnb=4203520 
kernel.msgmax=65536 
kernel.msgmni=32768 
kernel.sem=501000 641280000 501000 12800 
fs.aio-max-nr=6553600 
fs.file-max=26289810 
net.core.rmem_default=8388608 
net.core.rmem_max=16777216 
net.core.wmem_default=8388608 
net.core.wmem_max=16777216 
net.core.netdev_max_backlog=262144 
net.core.somaxconn= 65535 
net.ipv4.tcp_rmem=8192 87380 16777216 
net.ipv4.tcp_wmem=8192 65536 16777216 
net.ipv4.tcp_max_syn_backlog=262144 
net.ipv4.tcp_keepalive_time=180 
net.ipv4.tcp_keepalive_intvl=10 
net.ipv4.tcp_keepalive_probes=3 
net.ipv4.tcp_fin_timeout=1 
net.ipv4.tcp_synack_retries=1 
net.ipv4.tcp_syn_retries=1 
net.ipv4.tcp_syncookies=1 
net.ipv4.tcp_timestamps=1 
net.ipv4.tcp_tw_recycle=1 
net.ipv4.tcp_tw_reuse=1 
net.ipv4.tcp_max_tw_buckets=256000 
net.ipv4.tcp_retries1=2 
net.ipv4.tcp_retries2=3 
vm.dirty_background_ratio=5 
vm.dirty_expire_centisecs=6000 
vm.dirty_writeback_centisecs=500 
vm.dirty_ratio=20 
vm.overcommit_memory=0 
vm.overcommit_ratio= 120 
vm.vfs_cache_pressure = 100 
vm.swappiness=10 
vm.drop_caches = 2 
vm.min_free_kbytes = 2048000 
vm.zone_reclaim_mode=0 
kernel.core_uses_pid=1 
kernel.core_pattern= /data/antdb/core/core-%e-%p-%s-%t 
fs.suid_dumpable=1 
kernel.sysrq=0 
EOF 
```
The path of kernel.core_pattern needs to be modified according to the actual environment information. 2. execute the following command to make the above parameters effective.

```
sysctl -p 
```