This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: ‘2’ | |
services: | |
rs1: | |
image: mongo:3.2 | |
command: mongod — replSet “rs0” | |
rs2: | |
image: mongo:3.2 | |
command: mongod — replSet “rs0” | |
rs3: | |
image: mongo:3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure 3 replicas available | |
for rs in rs1 rs2 rs3;do | |
mongo --host $rs --eval 'db' | |
if [ $? -ne 0 ]; then | |
exit 1 | |
fi | |
done | |
# Connect to rs1 and check is replicaset already configured with 3 nodes | |
status=$(mongo --host rs1 --quiet --eval 'rs.status().members.length') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker network create --driver overlay db-net | |
docker service create --name rs1 --network db-net mongo:3.2 mongod --replSet "rs0" | |
docker service create --name rs2 --network db-net mongo:3.2 mongod --replSet "rs0" | |
docker service create --name rs3 --network db-net mongo:3.2 mongod --replSet "rs0" | |
docker service create --name rs --network db-net --restart-max-attempts 5 traxxs/mongors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker network create --driver overlay db-net | |
docker service create --name rs1 --network db-net mongo:3.2 mongod --replSet "rs0" | |
docker service create --name rs2 --network db-net mongo:3.2 mongod --replSet "rs0" | |
docker service create --name rs3 --network db-net mongo:3.2 mongod --replSet "rs0" | |
docker service create --name rs --network db-net --restart-max-attempts 10 lucj/mongors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rs0:PRIMARY> rs.status() | |
{ | |
"set" : "rs0", | |
"date" : ISODate("2016-09-30T07:05:58.418Z"), | |
"myState" : 1, | |
"term" : NumberLong(1), | |
"heartbeatIntervalMillis" : NumberLong(2000), | |
"members" : [ | |
{ | |
"_id" : 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker ps | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
eee52106c5b2 wordpress "docker-entrypoint.sh" About an hour ago Up About an hour 178.62.105.31:8080->80/tcp node-05/wp_wordpress_1 | |
9f86a11e90ee mariadb "docker-entrypoint.sh" About an hour ago Up About an hour 3306/tcp node-05/wp_db_1,node-05/wp_wordpress_1/db_1,node-05/wp_wordpress_1/mysql,node-05/wp_wordpress_1/wp_db_1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file controls the state of SELinux on the system. | |
# SELINUX= can take one of these three values: | |
# enforcing - SELinux security policy is enforced. | |
# permissive - SELinux prints warnings instead of enforcing. | |
# disabled - No SELinux policy is loaded. | |
SELINUX=enforcing | |
# SELINUXTYPE= can take one of three two values: | |
# targeted - Targeted processes are protected, | |
# minimum - Modification of targeted policy. Only selected processes are protected. | |
# mls - Multi Level Security protection. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -Z /usr/bin/docker* | |
-rwxr-xr-x. root root system_u:object_r:docker_exec_t:s0 /usr/bin/docker | |
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin/docker-containerd | |
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin/docker-containerd-ctr | |
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin/docker-containerd-shim | |
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin/dockerd | |
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin/docker-proxy | |
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin/docker-runc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -Z /usr/bin/docker* | |
-rwxr-xr-x. root root system_u:object_r:docker_exec_t:s0 /usr/bin/docker | |
-rwxr-xr-x. root root system_u:object_r:docker_exec_t:s0 /usr/bin/docker-containerd | |
-rwxr-xr-x. root root system_u:object_r:docker_exec_t:s0 /usr/bin/docker-containerd-ctr | |
-rwxr-xr-x. root root system_u:object_r:docker_exec_t:s0 /usr/bin/docker-containerd-shim | |
-rwxr-xr-x. root root system_u:object_r:docker_exec_t:s0 /usr/bin/dockerd | |
-rwxr-xr-x. root root system_u:object_r:docker_exec_t:s0 /usr/bin/docker-proxy | |
-rwxr-xr-x. root root system_u:object_r:docker_exec_t:s0 /usr/bin/docker-runc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ls -Z /usr/bin/docker* | |
-rwxr-xr-x. root root system_u:object_r:container_runtime_exec_t:s0 /usr/bin/docker | |
-rwxr-xr-x. root root system_u:object_r:container_runtime_exec_t:s0 /usr/bin/docker-current | |
-rwxr-xr-x. root root system_u:object_r:container_runtime_exec_t:s0 /usr/bin/docker-storage-setup | |
-rwx------. root root system_u:object_r:container_runtime_exec_t:s0 /usr/bin/docker-v1.10-migrator-helper | |
-rwx------. root root system_u:object_r:container_runtime_exec_t:s0 /usr/bin/docker-v1.10-migrator-local |