Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add command to check tikv user #6502

Merged
merged 15 commits into from
Jul 8, 2021
69 changes: 69 additions & 0 deletions br/backup-and-restore-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,75 @@ aliases: ['/docs-cn/dev/br/backup-and-restore-faq/']
>
> 因此,最好在恢复前提前检查权限。

如何检查权限:
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

1.使用Linux原生进程查询命令:
fengou1 marked this conversation as resolved.
Show resolved Hide resolved

{{< copyable "shell-regular" >}}

```bash
ps aux | grep tikv-server
```

命令输出示例:
fengou1 marked this conversation as resolved.
Show resolved Hide resolved

```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/fengou1/tidb-data/tikv-20162 --config conf/tikv.toml --log-file /home/fengou1/tidb-deploy/tikv-20162/log/tikv.log
fengou1 marked this conversation as resolved.
Show resolved Hide resolved
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/fengou1/tidb-data/tikv-20161 --config conf/tikv.toml --log-file /home/fengou1/tidb-deploy/tikv-20161/log/tikv.log
```

或者
fengou1 marked this conversation as resolved.
Show resolved Hide resolved

{{< copyable "shell-regular" >}}

```bash
ps aux | grep tikv-server | awk '{print $1}'
```

命令输出示例:
fengou1 marked this conversation as resolved.
Show resolved Hide resolved

```shell
tidb_ouo
tidb_ouo
```

2.使用tiup命令查询集群启动信息:
fengou1 marked this conversation as resolved.
Show resolved Hide resolved

{{< copyable "shell-regular" >}}

```bash
tiup cluster list
fengou1 marked this conversation as resolved.
Show resolved Hide resolved
```

命令输出示例:

```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
```

检查备份目录权限,如:backup目录是备份数据存储目录
fengou1 marked this conversation as resolved.
Show resolved Hide resolved

{{< copyable "shell-regular" >}}

```bash
ls -al backup
```

命令输出示例:
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

```shell
[root@Copy-of-VM-EE-CentOS76-v1 fengou1]# 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 ..
```

tikv-server为用户tidb_ouo启动,用户账号tidb_ouo没有权限写backup目录, 故备份失败。
fengou1 marked this conversation as resolved.
Show resolved Hide resolved

## BR 遇到错误信息 `Io(Os...)`,该如何处理?

这类问题几乎都是 TiKV 在写盘的时候遇到的系统调用错误。例如遇到 `Io(Os { code: 13, kind: PermissionDenied...})` 或者 `Io(Os { code: 2, kind: NotFound...})` 这类错误信息,首先检查备份目录的挂载方式和文件系统,试试看备份到其它文件夹或者其它硬盘。
Expand Down