HaProxy high availability cluster configuration Redis notes
Goal is to make a high-availability cluster for redis sensu use. redis cluster using Sentinel + Redis three-node configuration.
Blog post before configuring details
Sentinel can be done when the master hang up automatically elect a new master, then it is not a proxy.
Therefore, we need a proxy ip to provide a client used herein HaProxy the agent.
Taking into account the HaProxy single node failure, the use of master-slave HaProxy Keepalived do in order to achieve a high-availability cluster Redis.
tar zxvf haproxy-1.4.21.tar.gz
mv haproxy-1.4.21 /usr/local/haproxy
cd /usr/local/haproxy
make install
mkdir conf
cd conf
vim haproxy.cfg
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
chroot /usr/local/haproxy
uid 99
gid 99
daemon
#debug
#quiet
defaults
log global
mode tcp
option redispatch
option dontlognull
retries 2
maxconn 2000
balance roundrobin
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen proxy 10.166.224.37:6379
#redis
server redis_10.122.224.36 10.166.224.36:6379 check inter 2000 rise 2 fall 5
server redis_10.122.224.35 10.166.224.35:6379 check inter 2000 rise 2 fall 5
server redis_10.122.224.33 10.166.224.33:6379 check inter 2000 rise 2 fall 5
/usr/local/haproxy/haproxy -f /usr/local/haproxy/conf/haproxy.cfg
[root@app2 ~]# redis-cli -h 192.168.1.11
192.168.1.11:6379> INFO
# Server
redis_version:2.8.19
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:c0359e7aa3798aa2
redis_mode:standalone
os:Linux 3.10.0-327.28.3.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.3
process_id:14574
run_id:399a903ee13ab0b442d81020b174cafd5d91701a
tcp_port:6379
uptime_in_seconds:2820
uptime_in_days:0
hz:10
lru_clock:14238870
config_file:/etc/redis.conf
# Clients
connected_clients:2
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
# Memory
used_memory:857984
used_memory_human:837.88K
used_memory_rss:5955584
used_memory_peak:858120
used_memory_peak_human:838.01K
used_memory_lua:35840
mem_fragmentation_ratio:6.94
mem_allocator:jemalloc-3.6.0
# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1473855549
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:7
total_commands_processed:51
instantaneous_ops_per_sec:0
total_net_input_bytes:22221
total_net_output_bytes:37208
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:1
keyspace_misses:1
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:821
# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
# CPU
used_cpu_sys:1.03
used_cpu_user:0.69
used_cpu_sys_children:0.00
used_cpu_user_children:0.00
# Keyspace
db1:keys=5,expires=0,avg_ttl=0
Recent Comments