TiDB Backup Issues

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb 备份问题

| username: Cheriston

Does TIDB backup not require a username and password?

| username: Kongdom | Original post link

This doesn’t have read/write permissions, right? Mutual trust was already established during deployment, so there’s no need to enter a username and password here.

| username: 我是咖啡哥 | Original post link

What user is used to start TiDB? Is it the backup directory? Maybe it’s the permissions.

| username: TiDBer_vfJBUcxl | Original post link

The directory where the backup of node 102 is located does not have the necessary permissions. The script is executed with root privileges, and the owner of the directory is root. You need to change it so that the yidb user has write permissions.

| username: 像风一样的男子 | Original post link

I don’t understand what it means to create a directory for each IP address. Shouldn’t the directory be created on each KV server?

| username: 啦啦啦啦啦 | Original post link

No username or password is needed, just the PD address. The main issue is still directory permissions.

| username: Kongdom | Original post link

:yum: You replied incorrectly, I am not the original poster.

| username: tidb菜鸟一只 | Original post link

What does this script mean? Can it create the corresponding directory on each IP address?
If it can, check which user TiDB is deployed under. If it’s not root, you need to assign permissions.
Add the following under mkdir:
chown -R tidb:tidb /data/tidb_backup

| username: cassblanca | Original post link

This doesn’t seem appropriate. I understand that you want to determine the execution status of tidb_backup.sh, but it shouldn’t be judged within the tidb_backup.sh script itself, right?

| username: redgame | Original post link

Listen to the expert and check the permissions.

| username: TiDBer_vfJBUcxl | Original post link

I also think that this command should be executed on the 102 node. It can be done without putting it in a script, just execute it once:
chown -R tidb:tidb /data/tidb_backup

| username: TiDBer_vfJBUcxl | Original post link

The script first checks whether the backup is intended, and then determines whether the backup is successful based on the log content.

| username: Cheriston | Original post link

Solved: For reference only

| username: Kongdom | Original post link

:+1: :+1: :+1: So it’s a permissions issue?

| username: TiDBer_嘎嘣脆 | Original post link

Create a backup directory on each TiKV machine, then use BR to back up to the corresponding local:// directory.

| username: 昵称想不起来了 | Original post link

Learned :+1:

| username: zhanggame1 | Original post link

Using a 10 Gigabit network with NFS to create a shared directory is much more convenient. Restoring with a local directory using BR is particularly troublesome; you have to manually merge the backup data from each TiKV and then copy it to each TiKV backup directory.

| username: 像风一样的男子 | Original post link

It is still recommended to use NFS shared disk or S3 for backup and recovery, both are convenient.

| username: Kongdom | Original post link

Indeed, mounting on the intranet is very fast.