In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article example describes how centos6 uses docker to deploy redis master-slave database operations. Share with you for your reference, the details are as follows:
Directory structure:
/ redis
/ Dockerfile
/ Readme
/ redis-3.2.8.tar.gz
/ start.sh
Dockerfile:
FROM centosMAINTAINER qiongtao.li hnatao@126.comADD. / redis-3.2.8.tar.gz / optADD. / start.sh / opt/start_redis.shRUN echo "Asia/shanghai" > / etc/timezone\ & & cp / usr/share/zoneinfo/Asia/Shanghai / etc/localtime\ & & yum-y install gcc make\ & & ln-s / opt/redis-3.2.8 / opt/redis\ & & cd / opt/redis & make & & make installEXPOSE 6379ENTRYPOINT ["sh" "/ opt/start_redis.sh"]
Start.sh
Role=$1port=6379password=Abc123redis_conf=/opt/redis/redis.confdir=/data/redislogfile=/data/redis/redis.logmkdir-p $dirsed-I "s | bind 127.0.0.1 | bind 0.0.0.0 | g" $redis_confsed-I "s | # requirepass foobared | requirepass ${password} | g" $redis_confsed-I "s | dir. / | dir ${dir} | g" $redis_confsed-I "s | logfile\"\ "| logfile ${logfile} | g" $redis_confif ["$role" = "slave"] Then echo "slave" sed-I "s | # slaveof | slaveof redis-master ${port} | g" $redis_conf sed-I "s | # masterauth | masterauth ${password} | g" $redis_confelse echo "master" firedis-server $redis_conf
Readme
Docker rm-f redis-master redis-slave-1 redis-slave-2docker rmi-f redisdocker build-t redis. Docker run-d-- name redis-master redisdocker run-d-- name redis-slave-1-- link redis-master:redis-master redis slavedocker run-d-name redis-slave-2-- link redis-master:redis-master redis slavedocker ps-adocker exec redis-master redis-cli-an Abc123 set name hnataodocker exec redis-master redis-cli-an Abc123 get namedocker exec redis-slave-1 redis-cli -an Abc123 get namedocker exec redis-slave-2 redis-cli-an Abc123 get namedocker exec redis-master grep-E "bind | dir | require | logfile | slaveof | masterauth" / opt/redis/redis.confdocker exec redis-slave-1 grep-E "bind | dir | require | logfile | slaveof | masterauth" / opt/redis/redis.confdocker exec redis-slave-2 grep-E "bind | dir | require | logfile | slaveof | masterauth" / opt/redis/redis.confdocker exec redis-master redis-cli-an Abc123 infodocker exec redis-slave-1 redis-cli-an Abc123 infodocker exec redis-slave-2 redis-cli-an Abc123 info
Test installation deployment
Cat Readme | while read line; do $line; done
I hope what is described in this article will be helpful to the use of Docker containers.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.