這篇文章主要講解了“docker搭建redis集群的環(huán)境搭建”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“docker搭建redis集群的環(huán)境搭建”吧!
創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比南鄭網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式南鄭網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋南鄭地區(qū)。費(fèi)用合理售后完善,十載實(shí)體公司更值得信賴。
本文介紹了docker搭建redis集群的環(huán)境搭建,分享給大家,廢話不多說(shuō),具體如下:
下載鏡像
docker pull redis
準(zhǔn)備配置文件
mkdir /home/docker/redis/ wget https://raw.githubusercontent.com/antirez/redis/3.0/redis.conf -O /home/docker/redis/redis.conf cd /home/docker/redis/ sed -i 's/# slaveof/slaveof redis-master 6379/g' redis.conf
啟動(dòng)redis容器
docker run --name redis-master -p 6379:6379 -d redis docker run --link redis-master:redis-master -v /home/docker/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-slave1 -d redis redis-server /usr/local/etc/redis/redis.conf docker run --link redis-master:redis-master -v /home/docker/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-slave2 -d redis redis-server /usr/local/etc/redis/redis.conf docker run --link redis-master:redis-master -v /home/docker/redis/redis.conf:/usr/local/etc/redis/redis.conf --name redis-slave3 -d redis redis-server /usr/local/etc/redis/redis.conf
查看redis集群
redis-cli 127.0.0.1:6379> info # Server redis_version:3.0.6 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:48bba53ba79f07ac redis_mode:standalone os:Linux 3.13.0-27-generic x86_64 arch_bits:64 multiplexing_api:epoll gcc_version:4.9.2 process_id:1 run_id:6d552d47e50137b6ee40697d7254891aa5dbdb68 tcp_port:6379 uptime_in_seconds:21554 uptime_in_days:0 hz:10 lru_clock:10637013 config_file: # Clients connected_clients:1 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0 # Memory used_memory:1926248 used_memory_human:1.84M used_memory_rss:4419584 used_memory_peak:1963096 used_memory_peak_human:1.87M used_memory_lua:36864 mem_fragmentation_ratio:2.29 mem_allocator:jemalloc-3.6.0 # Persistence loading:0 rdb_changes_since_last_save:0 rdb_bgsave_in_progress:0 rdb_last_save_time:1453456066 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:0 rdb_current_bgsave_time_sec:-1 aof_enabled:0 aof_rewrite_in_progress:0 aof_rewrite_scheduled:0 aof_last_rewrite_time_sec:-1 aof_current_rewrite_time_sec:-1 aof_last_bgrewrite_status:ok aof_last_write_status:ok # Stats total_connections_received:5 total_commands_processed:64476 instantaneous_ops_per_sec:3 total_net_input_bytes:2426080 total_net_output_bytes:92455 instantaneous_input_kbps:0.14 instantaneous_output_kbps:0.02 rejected_connections:0 sync_full:3 sync_partial_ok:0 sync_partial_err:0 expired_keys:0 evicted_keys:0 keyspace_hits:0 keyspace_misses:0 pubsub_channels:0 pubsub_patterns:0 latest_fork_usec:222 migrate_cached_sockets:0 # Replication role:master connected_slaves:3 slave0:ip=172.17.0.2,port=6379,state=online,offset=30087,lag=1 slave1:ip=172.17.0.3,port=6379,state=online,offset=30101,lag=0 slave2:ip=172.17.0.4,port=6379,state=online,offset=30087,lag=1 master_repl_offset:30101 repl_backlog_active:1 repl_backlog_size:1048576 repl_backlog_first_byte_offset:2 repl_backlog_histlen:30100 # CPU used_cpu_sys:7.37 used_cpu_user:5.34 used_cpu_sys_children:0.00 used_cpu_user_children:0.00 # Cluster cluster_enabled:0 # Keyspace
感謝各位的閱讀,以上就是“docker搭建redis集群的環(huán)境搭建”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)docker搭建redis集群的環(huán)境搭建這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!