mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 21:21:14 +00:00
Update redis example to use alpine:3.4
This commit is contained in:
@@ -12,13 +12,14 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM redis:2.8
|
||||
RUN apt-get update
|
||||
RUN apt-get install -yy -q python
|
||||
FROM alpine:3.4
|
||||
|
||||
RUN apk add -U redis sed bash && rm -rf /var/cache/apk/*
|
||||
|
||||
COPY redis-master.conf /redis-master/redis.conf
|
||||
COPY redis-slave.conf /redis-slave/redis.conf
|
||||
COPY run.sh /run.sh
|
||||
|
||||
CMD [ "/run.sh" ]
|
||||
ENTRYPOINT [ "sh", "-c" ]
|
||||
|
||||
ENTRYPOINT [ "bash", "-c" ]
|
||||
|
@@ -61,7 +61,8 @@ tcp-backlog 511
|
||||
# Examples:
|
||||
#
|
||||
# bind 192.168.1.100 10.0.0.1
|
||||
# bind 127.0.0.1
|
||||
|
||||
bind 0.0.0.0
|
||||
|
||||
# Specify the path for the Unix socket that will be used to listen for
|
||||
# incoming connections. There is no default, so Redis will not listen
|
||||
|
@@ -61,7 +61,8 @@ tcp-backlog 511
|
||||
# Examples:
|
||||
#
|
||||
# bind 192.168.1.100 10.0.0.1
|
||||
# bind 127.0.0.1
|
||||
|
||||
bind 0.0.0.0
|
||||
|
||||
# Specify the path for the Unix socket that will be used to listen for
|
||||
# incoming connections. There is no default, so Redis will not listen
|
||||
|
@@ -19,7 +19,7 @@ function launchmaster() {
|
||||
echo "Redis master data doesn't exist, data won't be persistent!"
|
||||
mkdir /redis-master-data
|
||||
fi
|
||||
redis-server /redis-master/redis.conf
|
||||
redis-server /redis-master/redis.conf --protected-mode no
|
||||
}
|
||||
|
||||
function launchsentinel() {
|
||||
@@ -45,8 +45,9 @@ function launchsentinel() {
|
||||
echo "sentinel down-after-milliseconds mymaster 60000" >> ${sentinel_conf}
|
||||
echo "sentinel failover-timeout mymaster 180000" >> ${sentinel_conf}
|
||||
echo "sentinel parallel-syncs mymaster 1" >> ${sentinel_conf}
|
||||
echo "bind 0.0.0.0"
|
||||
|
||||
redis-sentinel ${sentinel_conf}
|
||||
redis-sentinel ${sentinel_conf} --protected-mode no
|
||||
}
|
||||
|
||||
function launchslave() {
|
||||
@@ -66,9 +67,9 @@ function launchslave() {
|
||||
echo "Connecting to master failed. Waiting..."
|
||||
sleep 10
|
||||
done
|
||||
perl -pi -e "s/%master-ip%/${master}/" /redis-slave/redis.conf
|
||||
perl -pi -e "s/%master-port%/6379/" /redis-slave/redis.conf
|
||||
redis-server /redis-slave/redis.conf
|
||||
sed -i "s/%master-ip%/${master}/" /redis-slave/redis.conf
|
||||
sed -i "s/%master-port%/6379/" /redis-slave/redis.conf
|
||||
redis-server /redis-slave/redis.conf --protected-mode no
|
||||
}
|
||||
|
||||
if [[ "${MASTER}" == "true" ]]; then
|
||||
|
Reference in New Issue
Block a user