diff --git a/check-before-deployment.md b/check-before-deployment.md index 995c0664b6283..c0a4882095887 100644 --- a/check-before-deployment.md +++ b/check-before-deployment.md @@ -24,8 +24,6 @@ Take the `/dev/nvme0n1` data disk as an example: 1. View the data disk. - {{< copyable "shell-root" >}} - ```bash fdisk -l ``` @@ -36,8 +34,6 @@ Take the `/dev/nvme0n1` data disk as an example: 2. Create the partition. - {{< copyable "shell-root" >}} - ```bash parted -s -a optimal /dev/nvme0n1 mklabel gpt -- mkpart primary ext4 1 -1 ``` @@ -55,8 +51,6 @@ Take the `/dev/nvme0n1` data disk as an example: 3. Format the data disk to the ext4 filesystem. - {{< copyable "shell-root" >}} - ```bash mkfs.ext4 /dev/nvme0n1p1 ``` @@ -65,8 +59,6 @@ Take the `/dev/nvme0n1` data disk as an example: In this example, the UUID of nvme0n1p1 is `c51eb23b-195c-4061-92a9-3fad812cc12f`. - {{< copyable "shell-root" >}} - ```bash lsblk -f ``` @@ -84,8 +76,6 @@ Take the `/dev/nvme0n1` data disk as an example: 5. Edit the `/etc/fstab` file and add the `nodelalloc` mount options. - {{< copyable "shell-root" >}} - ```bash vi /etc/fstab ``` @@ -96,8 +86,6 @@ Take the `/dev/nvme0n1` data disk as an example: 6. Mount the data disk. - {{< copyable "shell-root" >}} - ```bash mkdir /data1 && \ systemctl daemon-reload && \ @@ -106,8 +94,6 @@ Take the `/dev/nvme0n1` data disk as an example: 7. Check using the following command. - {{< copyable "shell-root" >}} - ```bash mount -t ext4 ``` @@ -178,8 +164,6 @@ The rest of this section describes how to stop the firewall service of a target 1. Check the firewall status. Take CentOS Linux release 7.7.1908 (Core) as an example. - {{< copyable "shell-regular" >}} - ```shell sudo firewall-cmd --state sudo systemctl status firewalld.service @@ -187,24 +171,18 @@ The rest of this section describes how to stop the firewall service of a target 2. Stop the firewall service. - {{< copyable "shell-regular" >}} - ```bash sudo systemctl stop firewalld.service ``` 3. Disable automatic start of the firewall service. - {{< copyable "shell-regular" >}} - ```bash sudo systemctl disable firewalld.service ``` 4. Check the firewall status. - {{< copyable "shell-regular" >}} - ```bash sudo systemctl status firewalld.service ``` @@ -219,8 +197,6 @@ To check whether the NTP service is installed and whether it synchronizes with t 1. Run the following command. If it returns `running`, then the NTP service is running. - {{< copyable "shell-regular" >}} - ```bash sudo systemctl status ntpd.service ``` @@ -233,8 +209,6 @@ To check whether the NTP service is installed and whether it synchronizes with t - If it returns `Unit ntpd.service could not be found.`, then try the following command to see whether your system is configured to use `chronyd` instead of `ntpd` to perform clock synchronization with NTP: - {{< copyable "shell-regular" >}} - ```bash sudo systemctl status chronyd.service ``` @@ -255,8 +229,6 @@ To check whether the NTP service is installed and whether it synchronizes with t > > For the Ubuntu system, you need to install the `ntpstat` package. - {{< copyable "shell-regular" >}} - ```bash ntpstat ``` @@ -287,8 +259,6 @@ To check whether the NTP service is installed and whether it synchronizes with t > > This only applies to systems that use Chrony instead of NTPd. - {{< copyable "shell-regular" >}} - ```bash chronyc tracking ``` @@ -325,8 +295,6 @@ To check whether the NTP service is installed and whether it synchronizes with t To make the NTP service start synchronizing as soon as possible, run the following command. Replace `pool.ntp.org` with your NTP server. -{{< copyable "shell-regular" >}} - ```bash sudo systemctl stop ntpd.service && \ sudo ntpdate pool.ntp.org && \ @@ -335,8 +303,6 @@ sudo systemctl start ntpd.service To install the NTP service manually on the CentOS 7 system, run the following command: -{{< copyable "shell-regular" >}} - ```bash sudo yum install ntp ntpdate && \ sudo systemctl start ntpd.service && \ @@ -359,8 +325,6 @@ Take the following steps to check the current operating system configuration and 1. Execute the following command to see whether THP is enabled or disabled: - {{< copyable "shell-regular" >}} - ```bash cat /sys/kernel/mm/transparent_hugepage/enabled ``` @@ -407,8 +371,6 @@ Take the following steps to check the current operating system configuration and 3. Execute the following command to see the `ID_SERIAL` of the disk: - {{< copyable "shell-regular" >}} - ```bash udevadm info --name=/dev/sdb | grep ID_SERIAL ``` @@ -425,8 +387,6 @@ Take the following steps to check the current operating system configuration and 4. Execute the following command to see the power policy of the cpufreq module: - {{< copyable "shell-regular" >}} - ```bash cpupower frequency-info --policy ``` @@ -447,8 +407,6 @@ Take the following steps to check the current operating system configuration and 1. Execute the `tuned-adm list` command to see the tuned profile of the current operating system: - {{< copyable "shell-regular" >}} - ```bash tuned-adm list ``` @@ -472,8 +430,6 @@ Take the following steps to check the current operating system configuration and 2. Create a new tuned profile: - {{< copyable "shell-regular" >}} - ```bash mkdir /etc/tuned/balanced-tidb-optimal/ vi /etc/tuned/balanced-tidb-optimal/tuned.conf @@ -502,8 +458,6 @@ Take the following steps to check the current operating system configuration and > > If your device uses the `noop` or `none` I/O Scheduler, skip this step. No Scheduler configuration is needed in the tuned profile. - {{< copyable "shell-regular" >}} - ```bash tuned-adm profile balanced-tidb-optimal ``` @@ -516,8 +470,6 @@ Take the following steps to check the current operating system configuration and > > Install the `grubby` package first before you execute `grubby`. - {{< copyable "shell-regular" >}} - ```bash grubby --default-kernel ``` @@ -528,20 +480,16 @@ Take the following steps to check the current operating system configuration and 2. Execute `grubby --update-kernel` to modify the kernel configuration: - {{< copyable "shell-regular" >}} - ```bash grubby --args="transparent_hugepage=never" --update-kernel `grubby --default-kernel` ``` > **Note:** > - > You can also specify the actual version number after `--update-kernel`, for example, `--update-kernel /boot/vmlinuz-3.10.0-957.el7.x86_64`. + > You can also specify the actual version number after `--update-kernel`, for example, `--update-kernel /boot/vmlinuz-3.10.0-957.el7.x86_64` or `ALL`. 3. Execute `grubby --info` to see the modified default kernel configuration: - {{< copyable "shell-regular" >}} - ```bash grubby --info /boot/vmlinuz-3.10.0-957.el7.x86_64 ``` @@ -561,8 +509,6 @@ Take the following steps to check the current operating system configuration and 4. Modify the current kernel configuration to immediately disable THP: - {{< copyable "shell-regular" >}} - ```bash echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/defrag @@ -570,8 +516,6 @@ Take the following steps to check the current operating system configuration and 5. Configure the I/O Scheduler in the udev script: - {{< copyable "shell-regular" >}} - ```bash vi /etc/udev/rules.d/60-tidb-schedulers.rules ``` @@ -588,8 +532,6 @@ Take the following steps to check the current operating system configuration and > > If your device uses the `noop` or `none` I/O Scheduler, skip this step. No udev rules configuration is needed. - {{< copyable "shell-regular" >}} - ```bash udevadm control --reload-rules udevadm trigger --type=devices --action=change @@ -597,8 +539,6 @@ Take the following steps to check the current operating system configuration and 7. Create a service to configure the CPU power policy: - {{< copyable "shell-regular" >}} - ```bash cat >> /etc/systemd/system/cpupower.service << EOF [Unit] @@ -613,8 +553,6 @@ Take the following steps to check the current operating system configuration and 8. Apply the CPU power policy configuration service: - {{< copyable "shell-regular" >}} - ```bash systemctl daemon-reload systemctl enable cpupower.service @@ -623,8 +561,6 @@ Take the following steps to check the current operating system configuration and 6. Execute the following command to verify the THP status: - {{< copyable "shell-regular" >}} - ```bash cat /sys/kernel/mm/transparent_hugepage/enabled ``` @@ -635,8 +571,6 @@ Take the following steps to check the current operating system configuration and 7. Execute the following command to verify the I/O Scheduler of the disk where the data directory is located: - {{< copyable "shell-regular" >}} - ```bash cat /sys/block/sd[bc]/queue/scheduler ``` @@ -648,8 +582,6 @@ Take the following steps to check the current operating system configuration and 8. Execute the following command to see the power policy of the cpufreq module: - {{< copyable "shell-regular" >}} - ```bash cpupower frequency-info --policy ``` @@ -662,8 +594,6 @@ Take the following steps to check the current operating system configuration and 9. Execute the following commands to modify the `sysctl` parameters: - {{< copyable "shell-regular" >}} - ```bash echo "fs.file-max = 1000000">> /etc/sysctl.conf echo "net.core.somaxconn = 32768">> /etc/sysctl.conf @@ -684,8 +614,6 @@ Take the following steps to check the current operating system configuration and 10. Execute the following command to configure the user's `limits.conf` file: - {{< copyable "shell-regular" >}} - ```bash cat << EOF >>/etc/security/limits.conf tidb soft nofile 1000000 @@ -701,8 +629,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 1. Log in to the target machine respectively using the `root` user account, create the `tidb` user and set the login password. - {{< copyable "shell-root" >}} - ```bash useradd tidb && \ passwd tidb @@ -710,8 +636,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 2. To configure sudo without password, run the following command, and add `tidb ALL=(ALL) NOPASSWD: ALL` to the end of the file: - {{< copyable "shell-root" >}} - ```bash visudo ``` @@ -722,8 +646,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 3. Use the `tidb` user to log in to the control machine, and run the following command. Replace `10.0.1.1` with the IP of your target machine, and enter the `tidb` user password of the target machine as prompted. After the command is executed, SSH mutual trust is already created. This applies to other machines as well. Newly created `tidb` users do not have the `.ssh` directory. To create such a directory, execute the command that generates the RSA key. To deploy TiDB components on the control machine, configure mutual trust for the control machine and the control machine itself. - {{< copyable "shell-regular" >}} - ```bash ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub 10.0.1.1 @@ -731,8 +653,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 4. Log in to the control machine using the `tidb` user account, and log in to the IP of the target machine using `ssh`. If you do not need to enter the password and can successfully log in, then the SSH mutual trust is successfully configured. - {{< copyable "shell-regular" >}} - ```bash ssh 10.0.1.1 ``` @@ -743,8 +663,6 @@ This section describes how to manually configure the SSH mutual trust and sudo w 5. After you log in to the target machine using the `tidb` user, run the following command. If you do not need to enter the password and can switch to the `root` user, then sudo without password of the `tidb` user is successfully configured. - {{< copyable "shell-regular" >}} - ```bash sudo -su root ``` diff --git a/tiup/tiup-component-cluster-check.md b/tiup/tiup-component-cluster-check.md index 02f557ce0d1c1..1147901f9e0ce 100644 --- a/tiup/tiup-component-cluster-check.md +++ b/tiup/tiup-component-cluster-check.md @@ -52,6 +52,16 @@ Check the values of the following kernel parameters: Check whether THP is enabled on the target machine. It is recommended to disable THP. +To check if THP is enabled you can run this: + +``` +cat /sys/kernel/mm/transparent_hugepage/enabled +``` + +If it is not set to `never`, you can change it with `grubby --update-kernel=ALL --args="transparent_hugepage=never"`. + +To change the running configuration, either reboot or run `echo never > /sys/kernel/mm/transparent_hugepage/enabled`. + ### System limits Check the limit values in the `/etc/security/limits.conf` file: diff --git a/tune-operating-system.md b/tune-operating-system.md index ca118bacb0133..9007714bcc7b0 100644 --- a/tune-operating-system.md +++ b/tune-operating-system.md @@ -70,6 +70,7 @@ It is **NOT** recommended to use THP for database applications, because database ```shell echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/defrag +grubby --update-kernel="$KERNEL" --args='transparent_hugepage=never' ``` ### Memory—virtual memory parameters