Get the App
SLTechnology News&Howtos  ›  Servers  › 

Setting up the Environment of redis Cluster by docker

Shulou Source: shulou.com Published: 2022-06-01 14:15:04 10月03日 Update

This article mainly explains "the environment for docker to build redis cluster". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "docker to build redis cluster environment".

This article introduces the environment for docker to build redis cluster and share it with you. No more nonsense, details are as follows:

Download the image

Docker pull redis

Prepare the configuration file

Mkdir / home/docker/redis/ wget https://raw.githubusercontent.com/antirez/redis/3.0/redis.conf-O / home/docker/redis/redis.confcd / home/docker/redis/ sed-I's Unip # slaveof / slaveof redis-master 6379Mather g 'redis.conf

Start the redis container

Docker run-- name redis-master-p 6379 d redisdocker 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.confdocker 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.confdocker 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

View redis clusters

Redis-cli 127.0.0.1 redis-cli 6379 > info# Serverredis_version:3.0.6redis_git_sha1:00000000redis_git_dirty:0redis_build_id:48bba53ba79f07acredis_mode:standaloneos:Linux 3.13.0-27-generic x86_64arch_bits:64multiplexing_api:epollgcc_version:4.9.2process_id:1run_id:6d552d47e50137b6ee40697d7254891aa5dbdb68tcp_port:6379uptime_in_seconds:21554uptime_in_days:0hz:10lru_clock:10637013config_file:# Clientsconnected_clients:1client_longest_output_list : 0client_biggest_input_buf:0blocked_clients:0# Memoryused_memory:1926248used_memory_human:1.84Mused_memory_rss:4419584used_memory_peak:1963096used_memory_peak_human:1.87Mused_memory_lua:36864mem_fragmentation_ratio:2.29mem_allocator:jemalloc-3.6.0# Persistenceloading:0rdb_changes_since_last_save:0rdb_bgsave_in_progress:0rdb_last_save_time:1453456066rdb_last_bgsave_status:okrdb_last_bgsave_time_sec : 0rdb_current_bgsave_time_sec:-1aof_enabled:0aof_rewrite_in_progress:0aof_rewrite_scheduled:0aof_last_rewrite_time_sec:-1aof_current_rewrite_time_sec:-1aof_last_bgrewrite_status:okaof_last_write_status:ok# Statstotal_connections_received:5total_commands_processed:64476instantaneous_ops_per_sec:3total_net_input_bytes:2426080total_net_output_bytes:92455instantaneous_input_kbps:0.14instantaneous_output_kbps: 0.02rejected_connections:0sync_full:3sync_partial_ok:0sync_partial_err:0expired_keys:0evicted_keys:0keyspace_hits:0keyspace_misses:0pubsub_channels:0pubsub_patterns:0latest_fork_usec:222migrate_cached_sockets:0# Replicationrole:masterconnected_slaves:3slave0:ip=172.17.0.2 Port=6379,state=online,offset=30087,lag=1slave1:ip=172.17.0.3,port=6379,state=online,offset=30101,lag=0slave2:ip=172.17.0.4,port=6379,state=online,offset=30087,lag=1master_repl_offset:30101repl_backlog_active:1repl_backlog_size:1048576repl_backlog_first_byte_offset:2repl_backlog_histlen:30100# CPUused_cpu_sys:7.37used_cpu_user:5.34used_cpu_sys_children:0.00used_cpu_user_children:0.00# Clustercluster_enabled:0# Keyspace, thank you for your reading. The above is the content of "docker building redis cluster environment". After the study of this article, I believe you have a deeper understanding of the problem of docker building redis cluster environment, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Clusters environments learning content containers that is nonsense ideas situations documents articles more knowledge knowledge points articles follow mirror questions preparation practice Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Linux Microsoft vpn MariaDB