Commit f5fd96e9 authored by iamabhishek-dubey's avatar iamabhishek-dubey

Updated image for node updates

parent 56fa545c
build-redis-image:
docker build -t opstree/redis:dev -f Dockerfile .
docker build -t opstree/redis:1.0 -f Dockerfile .
build-redis-exporter-image:
docker build -t opstree/redis-exporter:dev -f Dockerfile.exporter .
docker build -t opstree/redis-exporter:1.0 -f Dockerfile.exporter .
setup-standalone-server-compose:
docker-compose -f docker-compose-standalone.yaml up -d
......
......@@ -10,6 +10,7 @@ services:
REDIS_PASSWORD: "Opstree@12345"
SETUP_MODE: cluster
SERVER_MODE: master
PERSISTENCE_ENABLED: "true"
healthcheck:
test: ["CMD-SHELL", "/bin/bash /usr/bin/healthcheck.sh"]
......@@ -23,6 +24,7 @@ services:
REDIS_PASSWORD: "Opstree@12345"
SETUP_MODE: cluster
SERVER_MODE: master
PERSISTENCE_ENABLED: "true"
healthcheck:
test: ["CMD-SHELL", "/bin/bash /usr/bin/healthcheck.sh"]
......@@ -37,6 +39,7 @@ services:
SETUP_MODE: cluster
SERVER_MODE: master
MASTER_LIST: "10.5.0.2:6379 10.5.0.3:6379 10.5.0.4:6379"
PERSISTENCE_ENABLED: "true"
healthcheck:
test: ["CMD-SHELL", "/bin/bash /usr/bin/healthcheck.sh"]
......@@ -52,6 +55,7 @@ services:
SERVER_MODE: slave
SLAVE_IP: "10.5.0.5:6379"
MASTER_IP: "10.5.0.2:6379"
PERSISTENCE_ENABLED: "true"
healthcheck:
test: ["CMD-SHELL", "/bin/bash /usr/bin/healthcheck.sh"]
......@@ -67,6 +71,7 @@ services:
SERVER_MODE: slave
SLAVE_IP: "10.5.0.6:6379"
MASTER_IP: "10.5.0.3:6379"
PERSISTENCE_ENABLED: "true"
healthcheck:
test: ["CMD-SHELL", "/bin/bash /usr/bin/healthcheck.sh"]
......@@ -82,6 +87,7 @@ services:
SERVER_MODE: slave
SLAVE_IP: "10.5.0.7:6379"
MASTER_IP: "10.5.0.4:6379"
PERSISTENCE_ENABLED: "true"
healthcheck:
test: ["CMD-SHELL", "/bin/bash /usr/bin/healthcheck.sh"]
......
#!/bin/bash
set -ex
set -a
CLUSTER_DIRECTORY=${CLUSTER_DIRECTORY:-"/opt/redis"}
PERSISTENCE_ENABLED=${PERSISTENCE_ENABLED:-"false"}
DATA_DIR=${DATA_DIR:-"/data"}
common_operation() {
mkdir -p "${CLUSTER_DIRECTORY}"
mkdir -p "${DATA_DIR}"
}
set_redis_password() {
if [[ -z "${REDIS_PASSWORD}" ]]; then
......@@ -17,22 +26,47 @@ redis_mode_setup() {
if [[ "${SETUP_MODE}" == "cluster" ]]; then
{
echo cluster-enabled yes
echo cluster-config-file nodes.conf
echo cluster-node-timeout 5000
echo cluster-require-full-coverage no
echo cluster-migration-barrier 1
echo cluster-config-file "${DATA_DIR}/nodes.conf"
} >> /etc/redis/redis.conf
if [[ -z "${POD_IP}" ]]; then
POD_IP=$(hostname -i)
fi
sed -i -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/" "${DATA_DIR}/nodes.conf"
else
echo "Setting up redis in standalone mode"
fi
}
persistence_setup() {
if [[ "${PERSISTENCE_ENABLED}" == "true" ]]; then
{
echo save 900 1
echo save 300 10
echo save 60 10000
echo appendonly yes
echo appendfilename \"appendonly.aof\"
echo dir "${DATA_DIR}"
} >> /etc/redis/redis.conf
else
echo "Running without persistence mode"
fi
}
start_redis() {
echo "Starting redis service....."
redis-server /etc/redis/redis.conf
}
main_function() {
common_operation
set_redis_password
redis_mode_setup
persistence_setup
start_redis
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment