|
9 | 9 | ## Ensure that you have 3-Node Docker Swarm Cluster
|
10 | 10 |
|
11 | 11 | ```
|
12 |
| -docker node ls |
| 12 | +dockercaptain1981@node1:~$ sudo docker node ls |
| 13 | +ID HOSTNAME STATUS AVAIL |
| 14 | +ABILITY MANAGER STATUS ENGINE VERSION |
| 15 | +u7f4lsnzjswaesc8gk6qo69m2 * node1 Ready Active Leader 19.03.5 |
| 16 | +nhp0mnp2a0ciakxyzu9n6u0wz node2 Ready Active 19.03.5 |
| 17 | +u1xqjql3i9fvu9kvhfsy8c3kc node3 Ready Active 19.03.5 |
| 18 | +dockercaptain1981@node1:~$ |
13 | 19 | ```
|
14 | 20 |
|
15 | 21 | ## Ensure that Docker Compose is installed on the Manager Node
|
@@ -50,3 +56,69 @@ ID NAME DESCRIPTION
|
50 | 56 | dockercaptain1981@node1:~/dockerlabs/solution/viz$
|
51 | 57 | ```
|
52 | 58 |
|
| 59 | +# Creating Docker Volumes |
| 60 | + |
| 61 | +``` |
| 62 | +dockercaptain1981@node1:~$ sudo docker volume create --driver rexray/gcepd |
| 63 | +--name storage1 --opt=size=32 |
| 64 | +storage1 |
| 65 | +dockercaptain1981@node1:~$ sudo docker volume create --driver rexray/gcepd |
| 66 | +--name storage2 --opt=size=32 |
| 67 | +storage2 |
| 68 | +dockercaptain1981@node1:~$ |
| 69 | +``` |
| 70 | + |
| 71 | +``` |
| 72 | +dockercaptain1981@node1:~$ sudo docker volume ls |
| 73 | +DRIVER VOLUME NAME |
| 74 | +rexray/gcepd:latest storage1 |
| 75 | +rexray/gcepd:latest storage2 |
| 76 | +rexray/gcepd:latest storage11 |
| 77 | +dockercaptain1981@node1:~$ |
| 78 | +``` |
| 79 | + |
| 80 | +We need to setup RexRay Plugin on all those nodes. It can be done manually or we have swarm-exec.sh script which can install RexRay in a single shot on all Swarm Nodes. |
| 81 | + |
| 82 | +``` |
| 83 | +git clone https://github.com/mavenugo/swarm-exec |
| 84 | +sudo ./swarm-exec.sh docker plugin install –grant-all-permissions rexray/gcepd GCEPD_TAG=rexray |
| 85 | +``` |
| 86 | + |
| 87 | +OR |
| 88 | + |
| 89 | +You can run the below command on all the nodes |
| 90 | + |
| 91 | +``` |
| 92 | +sudo docker plugin install --grant-all-permissions rexray/gcepd GCEPD_TAG=rexray |
| 93 | +``` |
| 94 | + |
| 95 | +## Listing the Volumes on all the worker nodes |
| 96 | + |
| 97 | +``` |
| 98 | +dockercaptain1981@node3:~$ sudo docker volume ls |
| 99 | +DRIVER VOLUME NAME |
| 100 | +rexray/gcepd:latest storage1 |
| 101 | +rexray/gcepd:latest storage2 |
| 102 | +dockercaptain1981@node3:~$ |
| 103 | +``` |
| 104 | + |
| 105 | +## Creating Collabnet Network |
| 106 | + |
| 107 | +``` |
| 108 | +dockercaptain1981@node1:~/dockerlabs/solution/viz/swarm-exec$ sudo docker network create -d overlay collabnet |
| 109 | +n017dxky7i44eoxdk6nweep7v |
| 110 | +``` |
| 111 | + |
| 112 | + |
| 113 | +## Creating MySQL DB Service |
| 114 | + |
| 115 | +``` |
| 116 | +dockercaptain1981@node1:~/dockerlabs/solution/viz/swarm-exec$ sudo docker service create --replicas 4 --name wordpressdb1 --network=collabnet --mount type=volume,source=storage1,target=/var/lib/mysql,volume-driver=rexray/gcepd -e MYSQL_ROOT_PASSWORD=collab123 --env MYSQL_DATABASE=wordpress mysql:5.7 |
| 117 | +wrdv3ci6so28vm9gv30szvsyu |
| 118 | +overall progress: 0 out of 4 tasks |
| 119 | +1/4: preparing |
| 120 | +2/4: preparing |
| 121 | +3/4: preparing |
| 122 | +``` |
| 123 | + |
| 124 | + |
0 commit comments