MySQL Cluster Docker Images

MySQL Cluster Docker Images
These are optimized MySQL Cluster Docker images, created and maintained by the MySQL team at Oracle. The available versions are:

MySQL Cluster 7.5 (tag: 7.5)
MySQL Cluster 7.6 (tag: 7.6)
MySQL Cluster 8.0, the latest GA version (tag: 8.0 or latest)
Images are updated when new MySQL Cluster maintenance releases and development milestones are published. Please note that all MySQL Cluster Docker images are to be considered experiemental and should not be used in production.

How to Use the MySQL Cluster Images
Start a MySQL Cluster Using Default Configuration
Note that the ordering of container startup is very strict, and will likely need to be started from scratch if any step fails First we create an internal Docker network that the containers will use to communicate

docker network create cluster --subnet=192.168.0.0/16
Then we start the management node

docker run -d --net=cluster --name=management1 --ip=192.168.0.2 mysql/mysql-cluster ndb_mgmd
The two data nodes

docker run -d --net=cluster --name=ndb1 --ip=192.168.0.3 mysql/mysql-cluster ndbd
docker run -d --net=cluster --name=ndb2 --ip=192.168.0.4 mysql/mysql-cluster ndbd
And finally the MySQL server node

docker run -d --net=cluster --name=mysql1 --ip=192.168.0.10 -e MYSQL_RANDOM_ROOT_PASSWORD=true mysql/mysql-cluster mysqld
The server will be initialized with a randomized password that will need to be changed, so fetch it from the log, then log in and change the password. If you get an error saying «ERROR 2002 (HY000): Can’t connect to local MySQL server through socket» then the server has not finished initializing yet.

docker logs mysql1 2>&1 | grep PASSWORD
docker exec -it mysql1 mysql -uroot -p
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘MyNewPass’;
Finally start a container with an interactive management client to verify that the cluster is up

docker run -it --net=cluster mysql/mysql-cluster ndb_mgm
Run the SHOW command to print cluster status. You should see the following

Starting ndb_mgm
– NDB Cluster – Management Client –
ndb_mgm> show
Connected to Management Server at: 192.168.0.2:1186
Cluster Configuration

[ndbd(NDB)] 2 node(s)
id=2 @192.168.0.3 (mysql-5.7.18 ndb-7.6.2, Nodegroup: 0, *)
id=3 @192.168.0.4 (mysql-5.7.18 ndb-7.6.2, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.2 (mysql-5.7.18 ndb-7.6.2)

[mysqld(API)] 1 node(s)
id=4 @192.168.0.10 (mysql-5.7.18 ndb-7.6.2)
Customizing MySQL Cluster
The default MySQL Cluster image includes two config files which are also available in the github repository at https://github.com/mysql/mysql-docker/tree/mysql-cluster

/etc/my.cnf
/etc/mysql-cluster.cnf To change the cluster, for instance by adding more nodes or change the network setup, these files must be updated. For more information on how to do so, please refer to the MySQL Cluster documentation at to https://dev.mysql.com/doc/index-cluster.html To map up custom config files when starting the container, add the -v flag to load an external file. Example: docker run -d --net=cluster --name=management1 --ip=192.168.0.2 -v /mysql-cluster.cnf:/etc/mysql-cluster.cnf mysql/mysql-cluster ndb_mgmd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值