{"id":6293,"date":"2016-09-14T20:48:25","date_gmt":"2016-09-14T12:48:25","guid":{"rendered":"http:\/\/rmohan.com\/?p=6293"},"modified":"2016-09-14T20:48:25","modified_gmt":"2016-09-14T12:48:25","slug":"haproxy-high-availability-cluster-configuration-redis-notes","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6293","title":{"rendered":"HaProxy high availability cluster configuration Redis notes"},"content":{"rendered":"<h1 class=\"aTitle\"><strong><span class=\"notranslate\">HaProxy high availability cluster configuration Redis notes<\/span><\/strong><\/h1>\n<p>Goal is to make a high-availability cluster for redis sensu use. redis cluster using Sentinel + Redis three-node configuration.<br \/>\nBlog post before configuring details<\/p>\n<p>Sentinel can be done when the master hang up automatically elect a new master, then it is not a proxy.<br \/>\nTherefore, we need a proxy ip to provide a client used herein HaProxy the agent.<br \/>\nTaking into account the HaProxy single node failure, the use of master-slave HaProxy Keepalived do in order to achieve a high-availability cluster Redis.<\/p>\n<p>tar zxvf haproxy-1.4.21.tar.gz<br \/>\nmv haproxy-1.4.21 \/usr\/local\/haproxy<br \/>\ncd \/usr\/local\/haproxy<br \/>\nmake install<\/p>\n<p>mkdir conf<br \/>\ncd conf<br \/>\nvim haproxy.cfg<\/p>\n<p>global<br \/>\nlog 127.0.0.1\u00a0\u00a0 local0<br \/>\nlog 127.0.0.1\u00a0\u00a0 local1 notice<br \/>\n#log loghost\u00a0\u00a0\u00a0 local0 info<br \/>\nmaxconn 4096<br \/>\nchroot \/usr\/local\/haproxy<br \/>\nuid 99<br \/>\ngid 99<br \/>\ndaemon<br \/>\n#debug<br \/>\n#quiet<\/p>\n<p>defaults<br \/>\nlog\u00a0\u00a0\u00a0\u00a0 global<br \/>\nmode\u00a0\u00a0\u00a0 tcp<br \/>\noption\u00a0 redispatch<br \/>\noption\u00a0 dontlognull<br \/>\nretries 2<br \/>\nmaxconn 2000<br \/>\nbalance roundrobin<br \/>\ncontimeout\u00a0\u00a0\u00a0\u00a0\u00a0 5000<br \/>\nclitimeout\u00a0\u00a0\u00a0\u00a0\u00a0 50000<br \/>\nsrvtimeout\u00a0\u00a0\u00a0\u00a0\u00a0 50000<\/p>\n<p>listen\u00a0 proxy 10.166.224.37:6379<br \/>\n#redis<br \/>\nserver redis_10.122.224.36 10.166.224.36:6379 check inter 2000 rise 2 fall 5<br \/>\nserver redis_10.122.224.35 10.166.224.35:6379 check inter 2000 rise 2 fall 5<br \/>\nserver redis_10.122.224.33 10.166.224.33:6379 check inter 2000 rise 2 fall 5<\/p>\n<p>\/usr\/local\/haproxy\/haproxy -f \/usr\/local\/haproxy\/conf\/haproxy.cfg<\/p>\n<p>[root@app2 ~]# redis-cli -h 192.168.1.11<br \/>\n192.168.1.11:6379&gt; INFO<br \/>\n# Server<br \/>\nredis_version:2.8.19<br \/>\nredis_git_sha1:00000000<br \/>\nredis_git_dirty:0<br \/>\nredis_build_id:c0359e7aa3798aa2<br \/>\nredis_mode:standalone<br \/>\nos:Linux 3.10.0-327.28.3.el7.x86_64 x86_64<br \/>\narch_bits:64<br \/>\nmultiplexing_api:epoll<br \/>\ngcc_version:4.8.3<br \/>\nprocess_id:14574<br \/>\nrun_id:399a903ee13ab0b442d81020b174cafd5d91701a<br \/>\ntcp_port:6379<br \/>\nuptime_in_seconds:2820<br \/>\nuptime_in_days:0<br \/>\nhz:10<br \/>\nlru_clock:14238870<br \/>\nconfig_file:\/etc\/redis.conf<\/p>\n<p># Clients<br \/>\nconnected_clients:2<br \/>\nclient_longest_output_list:0<br \/>\nclient_biggest_input_buf:0<br \/>\nblocked_clients:0<\/p>\n<p># Memory<br \/>\nused_memory:857984<br \/>\nused_memory_human:837.88K<br \/>\nused_memory_rss:5955584<br \/>\nused_memory_peak:858120<br \/>\nused_memory_peak_human:838.01K<br \/>\nused_memory_lua:35840<br \/>\nmem_fragmentation_ratio:6.94<br \/>\nmem_allocator:jemalloc-3.6.0<\/p>\n<p># Persistence<br \/>\nloading:0<br \/>\nrdb_changes_since_last_save:0<br \/>\nrdb_bgsave_in_progress:0<br \/>\nrdb_last_save_time:1473855549<br \/>\nrdb_last_bgsave_status:ok<br \/>\nrdb_last_bgsave_time_sec:0<br \/>\nrdb_current_bgsave_time_sec:-1<br \/>\naof_enabled:0<br \/>\naof_rewrite_in_progress:0<br \/>\naof_rewrite_scheduled:0<br \/>\naof_last_rewrite_time_sec:-1<br \/>\naof_current_rewrite_time_sec:-1<br \/>\naof_last_bgrewrite_status:ok<br \/>\naof_last_write_status:ok<\/p>\n<p># Stats<br \/>\ntotal_connections_received:7<br \/>\ntotal_commands_processed:51<br \/>\ninstantaneous_ops_per_sec:0<br \/>\ntotal_net_input_bytes:22221<br \/>\ntotal_net_output_bytes:37208<br \/>\ninstantaneous_input_kbps:0.00<br \/>\ninstantaneous_output_kbps:0.00<br \/>\nrejected_connections:0<br \/>\nsync_full:0<br \/>\nsync_partial_ok:0<br \/>\nsync_partial_err:0<br \/>\nexpired_keys:0<br \/>\nevicted_keys:0<br \/>\nkeyspace_hits:1<br \/>\nkeyspace_misses:1<br \/>\npubsub_channels:0<br \/>\npubsub_patterns:0<br \/>\nlatest_fork_usec:821<\/p>\n<p># Replication<br \/>\nrole:master<br \/>\nconnected_slaves:0<br \/>\nmaster_repl_offset:0<br \/>\nrepl_backlog_active:0<br \/>\nrepl_backlog_size:1048576<br \/>\nrepl_backlog_first_byte_offset:0<br \/>\nrepl_backlog_histlen:0<\/p>\n<p># CPU<br \/>\nused_cpu_sys:1.03<br \/>\nused_cpu_user:0.69<br \/>\nused_cpu_sys_children:0.00<br \/>\nused_cpu_user_children:0.00<\/p>\n<p># Keyspace<br \/>\ndb1:keys=5,expires=0,avg_ttl=0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HaProxy high availability cluster configuration Redis notes <\/p>\n<p>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<\/p>\n<p>Sentinel can be done when the master hang up automatically elect a new master, then it is not a proxy. Therefore, we need a [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6293"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6293"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6293\/revisions"}],"predecessor-version":[{"id":6294,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6293\/revisions\/6294"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}