From fda26b16b360c3965aa21bd93e1f24a2955bde9f 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 1bb6ec0021e2a..5da9a46bec6da 100644 --- a/br/backup-and-restore-faq.md +++ b/br/backup-and-restore-faq.md @@ -36,7 +36,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 03ac8334209c1a79670dd8e7fe60d0bf8374486b 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 5da9a46bec6da..c2acf086e1fa7 100644 --- a/br/backup-and-restore-faq.md +++ b/br/backup-and-restore-faq.md @@ -36,9 +36,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" >}} @@ -53,7 +53,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" >}} @@ -68,7 +68,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" >}} @@ -86,7 +86,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" >}} @@ -103,7 +103,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 471a085a2ba5348b509c31601febca75e1f45348 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 c2acf086e1fa7..d9abf4c2aaeb4 100644 --- a/br/backup-and-restore-faq.md +++ b/br/backup-and-restore-faq.md @@ -38,7 +38,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" >}} @@ -53,7 +53,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" >}}