简体   繁体   English

Docker中的Bootstraping Percona Xtradb Cluster出现错误:无法打开和锁定特权表:表'mysql.user'不存在

[英]Bootstraping Percona Xtradb Cluster in Docker gives the error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

My goal is to get a Percona XtraDB Installation running in a Docker Container. 我的目标是要在Docker容器中运行Percona XtraDB安装。 For this i wrote up the following configuration. 为此,我写下了以下配置。

Dockerfile: Dockerfile:

FROM ubuntu:wily
ENV DEBIAN_FRONTEND noninteractive
#
# ENVIRONMENT INSTALL
#
RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get install -y wget curl netcat python-dev python-setuptools python-software-properties vim
RUN easy_install j2cli
COPY my.cnf.j2 /templates/
COPY docker-entrypoint.sh /
RUN chmod +x docker-entrypoint.sh /
#
# PERCONA XTRADB CLUSTER INSTALL
#
RUN echo "deb http://repo.percona.com/apt wily main" >>     /etc/apt/sources.list.d/percona.list
RUN echo "deb-src http://repo.percona.com/apt wily main" >>     /etc/apt/sources.list.d/percona.list
RUN apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
RUN apt-get update && apt-get install -y percona-xtradb-cluster-56
ENTRYPOINT ["/docker-entrypoint.sh"]

docker-entrypoint.sh docker-entrypoint.sh

#!/bin/bash -e
j2 /templates/my.cnf.j2 > /etc/mysql/my.cnf
exec bash

my.cnf.j2 my.cnf.j2

[mysqld]
user=mysql
default_storage_engine=InnoDB
basedir=/usr
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
innodb_autoinc_lock_mode=2
log_queries_not_using_indexes=1
max_allowed_packet=128M
binlog_format=ROW
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_node_address={{node_ip}}
wsrep_cluster_name="mycluster"
wsrep_cluster_address=gcomm://
wsrep_node_name={{node_name}}
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth="test:test"

!includedir /etc/mysql/conf.d/

wsrep_cluster_address=gcomm:// normally holds a list of 3 node WAN-IPs, i removed them due to privacy. wsrep_cluster_address = gcomm://通常包含3个节点WAN-IP的列表,出于隐私原因,我将其删除。

Building the image works perfectly fine with: 使用以下方法可以很好地构建图像:

docker build --rm -t test .

Starting works also fine with: 起始作品还可以与:

docker run --name Test1 -e "node_ip=127.0.0.1" -e "node_name=Test1" -p 3306:3306 -p 4567:4567 -p 4444:4444 -p 4568:4568 -i -t test

The variable node_ip points at the WAN-IP of my server, i set it to 127.0.0.1 just for privacy reasons. 变量node_ip指向服务器的WAN-IP,出于隐私原因,我将其设置为127.0.0.1。

But when i try to bootstrap mysql in the container with: 但是当我尝试使用以下命令在容器中引导mysql时:

/etc/init.d/mysql bootstrap-pxc

I get this error: 我收到此错误:

2016-03-28 09:24:09 354 [Note] Server hostname (bind-address): '*'; port: 3306
2016-03-28 09:24:09 354 [Note] IPv6 is available.
2016-03-28 09:24:09 354 [Note]   - '::' resolves to '::';
2016-03-28 09:24:09 354 [Note] Server socket created on IP: '::'.
2016-03-28 09:24:09 354 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
160328 09:24:09 mysqld_safe mysqld from pid file /var/lib/mysql/8605688929d8.pid ended

How can i solve this to get the XtraDB running in my Container? 如何解决此问题以使XtraDB在我的容器中运行?

mysql_install_db chown mysql.mysql -R /var/lib/mysql service mysql start

上面的方法似乎没有问题,请对其进行测试。

It could be a permissions problem. 可能是权限问题。 Try adding the following after your FROM statment: 尝试在FROM语句之后添加以下内容:

RUN useradd mysql \
    && mkdir /var/lib/mysql \
    && chown -R mysql:mysql /var/lib/mysql

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法打开和锁定权限表:表 'mysql.user' 不存在 - Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 致命错误:无法打开和锁定权限表:表 'mysql.host' 不存在 - Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 无法重新启动 MySQL Docker 容器,出现“无法打开 mysql.plugin 表”和“表 'mysql.user' 不存在”等错误 - Cannot restart the MySQL Docker container, gives errors like `Can't open the mysql.plugin table` and `Table 'mysql.user' doesn't exist` Mysql/mariadb“无法打开和锁定权限表:表‘mysql.servers’不存在” - Mysql/mariadb "Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist" 服务mysql启动在我的日志文件中留下“特权表:表'mysql.user'不存在”并且服务器失败 - service mysql start leaves “privilege tables: Table 'mysql.user' doesn't exist” in my log file and the server fails 表 'mysql.user' 不存在:错误 - Table 'mysql.user' doesn't exist:ERROR 移动数据后无法运行mysql(严重错误:无法打开和锁定特权表:表'mysql.host'不存在) - Cannot run mysql after moving data (Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist) Mysql给我:“无法打开和锁定特权表:表'主机'是只读的” - Mysql gives me:“Can't open and lock privilege tables: Table 'host' is read only” 无法在Percona-XtraDB-Cluster上安装mysql gem - Can't install mysql gem on Percona-XtraDB-Cluster 无法停止percona xtradb群集节点 - Can't stop percona xtradb cluster node
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM