docker mysql-cluster


[kiran@localhost ~]$ sudo yum install docker-ce


We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for kiran: 
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 14164.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  27 M RSS (909 MB VSZ)
    Started: Wed Mar 14 20:46:56 2018 - 00:42 ago
    State  : Sleeping, pid: 14164
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  27 M RSS (917 MB VSZ)
    Started: Wed Mar 14 20:46:56 2018 - 00:44 ago
    State  : Sleeping, pid: 14164
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  32 M RSS (914 MB VSZ)
    Started: Wed Mar 14 20:46:56 2018 - 00:46 ago
    State  : Running, pid: 14164
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  32 M RSS (914 MB VSZ)
    Started: Wed Mar 14 20:46:56 2018 - 00:48 ago
    State  : Running, pid: 14164
^C

Exiting on user cancel.
[kiran@localhost ~]$ sudo su -
[root@localhost ~]# sudo yum install docker-ce
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 14164.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  46 M RSS (928 MB VSZ)
    Started: Wed Mar 14 20:46:56 2018 - 01:01 ago
    State  : Sleeping, pid: 14164
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  46 M RSS (928 MB VSZ)
    Started: Wed Mar 14 20:46:56 2018 - 01:03 ago
    State  : Sleeping, pid: 14164
^C

Exiting on user cancel.
[root@localhost ~]# kill -9 14164
[root@localhost ~]# sudo yum install docker-ce
error: rpmdb: BDB0113 Thread/process 14164/140403357300544 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@localhost ~]#  sudo yum-config-manager \
>     --add-repo \
>     https://download.docker.com/linux/centos/docker-ce.repo
error: rpmdb: BDB0113 Thread/process 14164/140403357300544 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.cli:Yum Error: Error: rpmdb open failed
[root@localhost ~]# rpmdb -r
rpmdb: -r: missing argument
[root@localhost ~]# rpmdb -rf
rpmdb: only one major mode may be specified
[root@localhost ~]# yum update
error: rpmdb: BDB0113 Thread/process 14164/140403357300544 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@localhost ~]# yum clean all
error: rpmdb: BDB0113 Thread/process 14164/140403357300544 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@localhost ~]# rpm --rebuild
rpm: --rebuild: unknown option
[root@localhost ~]# rpm --rebuilddb
[root@localhost ~]#  sudo yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost ~]#  sudo yum-config-manager --enable docker-ce-edge
Loaded plugins: fastestmirror, langpacks
=========================================================== repo: docker-ce-edge ===========================================================
[docker-ce-edge]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = https://download.docker.com/linux/centos/7/x86_64/edge
cache = 0
cachedir = /var/cache/yum/x86_64/7/docker-ce-edge
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage = 
enabled = 1
enablegroups = True
exclude = 
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/docker-ce-edge/gpgcadir
gpgcakey = 
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/docker-ce-edge/gpgdir
gpgkey = https://download.docker.com/linux/centos/gpg
hdrdir = /var/cache/yum/x86_64/7/docker-ce-edge/headers
http_caching = all
includepkgs = 
ip_resolve = 
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid = 
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink = 
minrate = 0
mirrorlist = 
mirrorlist_expire = 86400
name = Docker CE Edge - x86_64
old_base_cache_dir = 
password = 
persistdir = /var/lib/yum/repos/x86_64/7/docker-ce-edge
pkgdir = /var/cache/yum/x86_64/7/docker-ce-edge/packages
proxy = False
proxy_dict = 
proxy_password = 
proxy_username = 
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert = 
sslclientcert = 
sslclientkey = 
sslverify = True
throttle = 0
timeout = 30.0
ui_id = docker-ce-edge/x86_64
ui_repoid_vars = releasever,
   basearch
username = 

[root@localhost ~]# sudo yum-config-manager --enable docker-ce-test
Loaded plugins: fastestmirror, langpacks
=========================================================== repo: docker-ce-test ===========================================================
[docker-ce-test]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = https://download.docker.com/linux/centos/7/x86_64/test
cache = 0
cachedir = /var/cache/yum/x86_64/7/docker-ce-test
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage = 
enabled = 1
enablegroups = True
exclude = 
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/docker-ce-test/gpgcadir
gpgcakey = 
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/docker-ce-test/gpgdir
gpgkey = https://download.docker.com/linux/centos/gpg
hdrdir = /var/cache/yum/x86_64/7/docker-ce-test/headers
http_caching = all
includepkgs = 
ip_resolve = 
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid = 
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink = 
minrate = 0
mirrorlist = 
mirrorlist_expire = 86400
name = Docker CE Test - x86_64
old_base_cache_dir = 
password = 
persistdir = /var/lib/yum/repos/x86_64/7/docker-ce-test
pkgdir = /var/cache/yum/x86_64/7/docker-ce-test/packages
proxy = False
proxy_dict = 
proxy_password = 
proxy_username = 
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert = 
sslclientcert = 
sslclientkey = 
sslverify = True
throttle = 0
timeout = 30.0
ui_id = docker-ce-test/x86_64
ui_repoid_vars = releasever,
   basearch
username = 

[root@localhost ~]# sudo yum install docker-ce
Loaded plugins: fastestmirror, langpacks
docker-ce-edge                                                                                                       | 2.9 kB  00:00:00     
docker-ce-stable                                                                                                     | 2.9 kB  00:00:00     
docker-ce-test                                                                                                       | 2.9 kB  00:00:00     
(1/3): docker-ce-stable/x86_64/primary_db                                                                            |  11 kB  00:00:00     
(2/3): docker-ce-edge/x86_64/primary_db                                                                              |  14 kB  00:00:00     
(3/3): docker-ce-test/x86_64/primary_db                                                                              |  41 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: ftp.iitm.ac.in
 * extras: ftp.iitm.ac.in
 * updates: ftp.cuhk.edu.hk
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.03.0.ce-0.3.rc3.el7.centos will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.03.0.ce-0.3.rc3.el7.centos.x86_64
--> Processing Dependency: pigz for package: docker-ce-18.03.0.ce-0.3.rc3.el7.centos.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.42-1.gitad8f0f7.el7 will be installed
---> Package pigz.x86_64 0:2.3.3-1.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
 Package                          Arch                  Version                                         Repository                     Size
============================================================================================================================================
Installing:
 docker-ce                        x86_64                18.03.0.ce-0.3.rc3.el7.centos                   docker-ce-test                 35 M
Installing for dependencies:
 container-selinux                noarch                2:2.42-1.gitad8f0f7.el7                         extras                         32 k
 pigz                             x86_64                2.3.3-1.el7.centos                              extras                         68 k

Transaction Summary
============================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 35 M
Installed size: 151 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/extras/packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm is not installed
(1/3): container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm                                                            |  32 kB  00:00:00     
(2/3): pigz-2.3.3-1.el7.centos.x86_64.rpm                                                                            |  68 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/docker-ce-test/packages/docker-ce-18.03.0.ce-0.3.rc3.el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-18.03.0.ce-0.3.rc3.el7.centos.x86_64.rpm is not installed
(3/3): docker-ce-18.03.0.ce-0.3.rc3.el7.centos.x86_64.rpm                                                            |  35 MB  00:00:23     
--------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                       1.4 MB/s |  35 MB  00:00:23     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pigz-2.3.3-1.el7.centos.x86_64                                                                                           1/3 
  Installing : 2:container-selinux-2.42-1.gitad8f0f7.el7.noarch                                                                         2/3 
  Installing : docker-ce-18.03.0.ce-0.3.rc3.el7.centos.x86_64                                                                           3/3 
  Verifying  : 2:container-selinux-2.42-1.gitad8f0f7.el7.noarch                                                                         1/3 
  Verifying  : docker-ce-18.03.0.ce-0.3.rc3.el7.centos.x86_64                                                                           2/3 
  Verifying  : pigz-2.3.3-1.el7.centos.x86_64                                                                                           3/3 

Installed:
  docker-ce.x86_64 0:18.03.0.ce-0.3.rc3.el7.centos                                                                                          

Dependency Installed:
  container-selinux.noarch 2:2.42-1.gitad8f0f7.el7                             pigz.x86_64 0:2.3.3-1.el7.centos                            

Complete!
[root@localhost ~]# docker
docker                  docker-containerd-ctr   dockerd                 docker-proxy            
docker-containerd       docker-containerd-shim  docker-init             docker-runc             
[root@localhost ~]# docker network ls
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# cd /etc/init.d/
[root@localhost init.d]# ls
functions  netconsole  network  README
[root@localhost init.d]# service docker start
Redirecting to /bin/systemctl start docker.service
[root@localhost init.d]# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
e06fea36313b        bridge              bridge              local
8e6ad6d0fd8c        host                host                local
249f8db2efb7        none                null                local
[root@localhost init.d]# 

[root@localhost init.d]# ip -4 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 192.168.204.129/24 brd 192.168.204.255 scope global dynamic ens33
       valid_lft 1008sec preferred_lft 1008sec
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
[root@localhost init.d]# docker network create cluster --subnet=192.168.0.0/16
a88ce4c7487684d76c15fcfd9b199c8e1da207f599a33954d80408162bc85212
[root@localhost init.d]# docker run -d --net=cluster --name=management1 --ip=192.168.0.2 mysql/mysql-cluster ndb_mgmd
Unable to find image 'mysql/mysql-cluster:latest' locally
latest: Pulling from mysql/mysql-cluster
7bd9e1692b54: Pull complete 
366b33b15679: Pull complete 
73124ecf6887: Pull complete 
ddc990bcc448: Pull complete 
36efed6fd996: Pull complete 
70114fdb71c6: Pull complete 
Digest: sha256:c1480de6e95dcf7e34475616bd143fcf0b5c9a5b1e69c3dc069045815c12882f
Status: Downloaded newer image for mysql/mysql-cluster:latest
ce9a6d70f0b841cc63e4c47568661508b9b961aaa26a0821e4992c3eee50765e
[root@localhost init.d]# docker run -d --net=cluster --name=management1 --ip=192.168.0.2 mysql/mysql-cluster ndb_mgmd
docker: Error response from daemon: Conflict. The container name "/management1" is already in use by container "ce9a6d70f0b841cc63e4c47568661508b9b961aaa26a0821e4992c3eee50765e". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
[root@localhost init.d]# docker run -d --net=cluster --name=ndb1 --ip=192.168.0.3 mysql/mysql-cluster ndbd
b1cb1d3e78b736b79b9204bac35fe99f27858f1a493f8bf465c23c083ba1d433
[root@localhost init.d]# docker run -d --net=cluster --name=ndb2 --ip=192.168.0.4 mysql/mysql-cluster ndbd
fecebe7256c9f3777bfc2c49b4a42512fefc1c2f437b6fe6550b10c708be3647
[root@localhost init.d]# docker run -d --net=cluster --name=mysql1 --ip=192.168.0.10 mysql/mysql-cluster mysqld
161cb45796d08096ece338cc84a91c1c89bcb8707c2073f18af40e5ae8765e5d
[root@localhost init.d]# docker run -it --net=cluster mysql/mysql-cluster
[Entrypoint] MySQL Docker Image 7.5.7-1.1.0
[Entrypoint] ERROR: No password option specified for new database.
[Entrypoint]   You need to specify one of the following:
[Entrypoint]   - MYSQL_RANDOM_ROOT_PASSWORD (recommended)
[Entrypoint]   - MYSQL_ROOT_PASSWORD
[Entrypoint]   - MYSQL_ALLOW_EMPTY_PASSWORD
[root@localhost init.d]# docker logs mysql1 2>&1 | grep password
[Entrypoint] ERROR: No password option specified for new database.
[root@localhost init.d]# docker exec -it mysql1 mysql -uroot -p
Error response from daemon: Container 161cb45796d08096ece338cc84a91c1c89bcb8707c2073f18af40e5ae8765e5d is not running
[root@localhost init.d]# docker pull mysql/mysql-server:latest
latest: Pulling from mysql/mysql-server
4040fe120662: Pull complete 
d049aa45d358: Pull complete 
8804e1dda06d: Pull complete 
47202558e57c: Pull complete 
Digest: sha256:125a402f5b995d53a24d981c1111c8df624d4b49c51af6cf1fc2959dc449c8a7
Status: Downloaded newer image for mysql/mysql-server:latest
[root@localhost init.d]# docker ps
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                                     NAMES
fecebe7256c9        mysql/mysql-cluster   "/entrypoint.sh ndbd"    4 minutes ago       Up 4 minutes        1186/tcp, 2202/tcp, 3306/tcp, 33060/tcp   ndb2
b1cb1d3e78b7        mysql/mysql-cluster   "/entrypoint.sh ndbd"    4 minutes ago       Up 4 minutes        1186/tcp, 2202/tcp, 3306/tcp, 33060/tcp   ndb1
ce9a6d70f0b8        mysql/mysql-cluster   "/entrypoint.sh ndb_…"   5 minutes ago       Up 5 minutes        1186/tcp, 2202/tcp, 3306/tcp, 33060/tcp   management1

[root@localhost init.d]# docker exec -it ce9a6d70f0b8 /bin/bash
bash-4.2# ls
bin   docker-entrypoint-initdb.d  healthcheck.sh  lib64  opt   run   sys  var
boot  entrypoint.sh   home   media  proc  sbin  tmp
dev   etc   lib   mnt root  srv   usr
bash-4.2# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
bash-4.2# start mysql
bash: start: command not found
bash-4.2# ndb         
bash: ndb: command not found
bash-4.2# 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.19 ndb-7.5.7, Nodegroup: 0, *)
id=3 @192.168.0.4  (mysql-5.7.19 ndb-7.5.7, Nodegroup: 0)

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

[mysqld(API)] 1 node(s)
id=4 (not connected, accepting connect from 192.168.0.10)

Comments