当我使用外部数据目录运行Percona XtraDB Cluster时(我尝试从使用Percona XtraBackup制作的备份中恢复),出现错误:
--initialize specified but the data directory has files in it. Aborting.
我该如何解决?
码头工人命令:
docker run --name xtradb_from_backup -p 3307:3306 \
-e MYSQL_ROOT_PASSWORD=1 -e XTRABACKUP_PASSWORD=2 \
-e CLUSTER_NAME=xtradb -d -v ~/mysql/:/etc/mysql/conf.d \
-v /db:/var/lib/mysql percona/percona-xtradb-cluster:5.7.16 \
--pxc_strict_mode=PERMISSIVE;
我也尝试过MYSQL_ROOT_PASSWORD
根据文档省略:
docker run --name xtradb_from_backup -p 3307:3306 \
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes -e XTRABACKUP_PASSWORD=2 \
-e CLUSTER_NAME=xtradb -d -v ~/mysql/:/etc/mysql/conf.d \
-v /db:/var/lib/mysql percona/percona-xtradb-cluster:5.7.16 \
--pxc_strict_mode=PERMISSIVE;
错误日志:
Running --initialize-insecure on /var/lib/mysql/
total 345M
drwxrwxr-x 7 1001 root 4.0K Apr 13 14:53 .
drwxr-xr-x 19 root root 4.0K Dec 15 21:40 ..
-rw-r----- 1 1001 root 56 Apr 13 09:28 auto.cnf
...
-rw-r----- 1 1001 root 3.8M Apr 13 14:27 xb_doublewrite
-rw-r--r-- 1 1001 root 23 Apr 13 09:14 xtrabackup_binlog_info
-rw-r--r-- 1 1001 root 23 Apr 13 10:23 xtrabackup_binlog_pos_innodb
-rw-rw---- 1 1001 root 123 Apr 13 10:23 xtrabackup_checkpoints
-rw-r--r-- 1 1001 root 46 Apr 13 09:14 xtrabackup_galera_info
-rw-rw---- 1 1001 root 549 Apr 11 00:34 xtrabackup_info
-rw-rw---- 1 1001 root 158M Apr 13 09:14 xtrabackup_logfile
2017-04-13T14:53:02.875351Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2017-04-13T14:53:02.875413Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2017-04-13T14:53:02.875473Z 0 [Warning] WSREP: Node is running in bootstrap/initialize mode. Disabling pxc_strict_mode checks
2017-04-13T14:53:02.877589Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2017-04-13T14:53:02.877618Z 0 [ERROR] Aborting