From 783f48a11085a16ccd1e4525c0f44645904b76b9 Mon Sep 17 00:00:00 2001 From: Liuxiaozhen12 Date: Mon, 19 Jul 2021 14:25:04 +0800 Subject: [PATCH 1/3] add commands to check tikv user --- br/backup-and-restore-faq.md | 69 +++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/br/backup-and-restore-faq.md b/br/backup-and-restore-faq.md index 414f02b21ff06..4dfdb3eaf94a5 100644 --- a/br/backup-and-restore-faq.md +++ b/br/backup-and-restore-faq.md @@ -35,7 +35,74 @@ Running BR with the root access might fail due to the disk permission, because t > > You might encounter the same problem during data restoration. When the SST files are read for the first time, the read permission is verified. The execution duration of DDL suggests that there might be a long interval between checking the permission and running BR. You might receive the error message `Permission denied` after waiting for a long time. > -> Therefore, It is recommended to check the permission before data restoration. +> Therefore, It is recommended to check the permission before data restoration according to the following steps: + +1. execute Linux native command for process query: + + {{< copyable "shell-regular" >}} + + ```bash + ps aux | grep tikv-server + ``` + + The output of the above command: + + ```shell + tidb_ouo 9235 10.9 3.8 2019248 622776 ? Ssl 08:28 1:12 bin/tikv-server --addr 0.0.0.0:20162 --advertise-addr 172.16.6.118:20162 --status-addr 0.0.0.0:20188 --advertise-status-addr 172.16.6.118:20188 --pd 172.16.6.118:2379 --data-dir /home/user1/tidb-data/tikv-20162 --config conf/tikv.toml --log-file /home/user1/tidb-deploy/tikv-20162/log/tikv.log + tidb_ouo 9236 9.8 3.8 2048940 631136 ? Ssl 08:28 1:05 bin/tikv-server --addr 0.0.0.0:20161 --advertise-addr 172.16.6.118:20161 --status-addr 0.0.0.0:20189 --advertise-status-addr 172.16.6.118:20189 --pd 172.16.6.118:2379 --data-dir /home/user1/tidb-data/tikv-20161 --config conf/tikv.toml --log-file /home/user1/tidb-deploy/tikv-20161/log/tikv.log + ``` + + Or you can execute the following commands: + + {{< copyable "shell-regular" >}} + + ```bash + ps aux | grep tikv-server | awk '{print $1}' + ``` + + The output of the above command: + + ```shell + tidb_ouo + tidb_ouo + ``` + +2. query the startup information of the cluster using the TiUP command: + + {{< copyable "shell-regular" >}} + + ```bash + tiup cluster list + ``` + + The output of the above command: + + ```shell + [root@Copy-of-VM-EE-CentOS76-v1 br]# tiup cluster list + Starting component `cluster`: /root/.tiup/components/cluster/v1.5.2/tiup-cluster list + Name User Version Path PrivateKey + ---- ---- ------- ---- ---------- + tidb_cluster tidb_ouo v5.0.2 /root/.tiup/storage/cluster/clusters/tidb_cluster /root/.tiup/storage/cluster/clusters/tidb_cluster/ssh/id_rsa + ``` + +3. check permissions for backup directory, for example, `backup` directory is for data storage backup: + + {{< copyable "shell-regular" >}} + + ```bash + ls -al backup + ``` + + The output of the above command: + + ```shell + [root@Copy-of-VM-EE-CentOS76-v1 user1]# ls -al backup + total 0 + drwxr-xr-x 2 root root 6 Jun 28 17:48 . + drwxr-xr-x 11 root root 310 Jul 4 10:35 .. + ``` + + From the above output, you can find that `tikv-server` instance is started by user `tidb_ouo`. But because user `tidb_ouo` does not have the write permission for `backup`, backup fails. ## What should I do to handle the `Io(Os...)` error? From af9e9153675b88e77e67e7e2d796d2a0c4c4547a Mon Sep 17 00:00:00 2001 From: Liuxiaozhen12 <82579298+Liuxiaozhen12@users.noreply.github.com> Date: Thu, 5 Aug 2021 19:50:37 +0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- br/backup-and-restore-faq.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/br/backup-and-restore-faq.md b/br/backup-and-restore-faq.md index 4dfdb3eaf94a5..34bd3dfa1fbea 100644 --- a/br/backup-and-restore-faq.md +++ b/br/backup-and-restore-faq.md @@ -35,9 +35,9 @@ Running BR with the root access might fail due to the disk permission, because t > > You might encounter the same problem during data restoration. When the SST files are read for the first time, the read permission is verified. The execution duration of DDL suggests that there might be a long interval between checking the permission and running BR. You might receive the error message `Permission denied` after waiting for a long time. > -> Therefore, It is recommended to check the permission before data restoration according to the following steps: +> Therefore, it is recommended to check the permission before data restore according to the following steps: -1. execute Linux native command for process query: +1. Execute the Linux-native command for process query: {{< copyable "shell-regular" >}} @@ -52,7 +52,7 @@ Running BR with the root access might fail due to the disk permission, because t tidb_ouo 9236 9.8 3.8 2048940 631136 ? Ssl 08:28 1:05 bin/tikv-server --addr 0.0.0.0:20161 --advertise-addr 172.16.6.118:20161 --status-addr 0.0.0.0:20189 --advertise-status-addr 172.16.6.118:20189 --pd 172.16.6.118:2379 --data-dir /home/user1/tidb-data/tikv-20161 --config conf/tikv.toml --log-file /home/user1/tidb-deploy/tikv-20161/log/tikv.log ``` - Or you can execute the following commands: + Or you can execute the following command: {{< copyable "shell-regular" >}} @@ -67,7 +67,7 @@ Running BR with the root access might fail due to the disk permission, because t tidb_ouo ``` -2. query the startup information of the cluster using the TiUP command: +2. Query the startup information of the cluster using the TiUP command: {{< copyable "shell-regular" >}} @@ -85,7 +85,7 @@ Running BR with the root access might fail due to the disk permission, because t tidb_cluster tidb_ouo v5.0.2 /root/.tiup/storage/cluster/clusters/tidb_cluster /root/.tiup/storage/cluster/clusters/tidb_cluster/ssh/id_rsa ``` -3. check permissions for backup directory, for example, `backup` directory is for data storage backup: +3. Check the permission for the backup directory. For example, `backup` is for backup data storage: {{< copyable "shell-regular" >}} @@ -102,7 +102,7 @@ Running BR with the root access might fail due to the disk permission, because t drwxr-xr-x 11 root root 310 Jul 4 10:35 .. ``` - From the above output, you can find that `tikv-server` instance is started by user `tidb_ouo`. But because user `tidb_ouo` does not have the write permission for `backup`, backup fails. + From the above output, you can find that the `tikv-server` instance is started by the user `tidb_ouo`. But the user `tidb_ouo` does not have the write permission for `backup`, the backup fails. ## What should I do to handle the `Io(Os...)` error? From ccccb88c17e81f967870f25696c51e37bafa585b Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 25 Aug 2021 12:58:00 +0800 Subject: [PATCH 3/3] Apply suggestions from code review --- br/backup-and-restore-faq.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/br/backup-and-restore-faq.md b/br/backup-and-restore-faq.md index 34bd3dfa1fbea..74d00d8ea9660 100644 --- a/br/backup-and-restore-faq.md +++ b/br/backup-and-restore-faq.md @@ -37,7 +37,7 @@ Running BR with the root access might fail due to the disk permission, because t > > Therefore, it is recommended to check the permission before data restore according to the following steps: -1. Execute the Linux-native command for process query: +1. Run the Linux-native command for process query: {{< copyable "shell-regular" >}} @@ -52,7 +52,7 @@ Running BR with the root access might fail due to the disk permission, because t tidb_ouo 9236 9.8 3.8 2048940 631136 ? Ssl 08:28 1:05 bin/tikv-server --addr 0.0.0.0:20161 --advertise-addr 172.16.6.118:20161 --status-addr 0.0.0.0:20189 --advertise-status-addr 172.16.6.118:20189 --pd 172.16.6.118:2379 --data-dir /home/user1/tidb-data/tikv-20161 --config conf/tikv.toml --log-file /home/user1/tidb-deploy/tikv-20161/log/tikv.log ``` - Or you can execute the following command: + Or you can run the following command: {{< copyable "shell-regular" >}}