Welcome to Centmin Mod Community
Register Now

Redis Redis 4.0 Stable Release

Discussion in 'Other Centmin Mod Installed software' started by eva2000, Jul 15, 2017.

Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    30,632
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    11:51 AM
    Nginx 1.13.x
    MariaDB 5.5
    Redis 4.0 Stable release is out now Redis. Centmin Mod installs Redis 3.2 branch from Remi YUM repo if you follow instructions outlined here. There is currently no Redis 4.0 YUM packages available in Remi YUM repo so would have to install Redis 4.0 yourself if you know how.

    Release notes
    From Google Groups
     
    Last edited: Jul 15, 2017
    • Like Like x 1
  2. eva2000

    eva2000 Administrator Staff Member

    30,632
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    11:51 AM
    Nginx 1.13.x
    MariaDB 5.5

    Redis 4.0 Custom Install Example



    Did a quick custom source compiled Redis 4.0 install on CentOS 7.3 64bit with Redis 4.0 listening on custom TCP port 6479.
    Code (Text):
    ps aufxw | grep redis | grep -v grep
    redis    14735  0.1  0.3 142892  5796 ?        Ssl  19:53   0:00 /usr/bin/redis-server 127.0.0.1:6379
    redis    14808  0.1  0.1 145240  2628 ?        Ssl  19:55   0:00 /etc/redis6479/redis-server 127.0.0.1:6479
    


    Source Installed Redis 4.0

    Redis 4.0.0 listening on TCP port 6479
    Code (Text):
    /usr/local/bin/redis-server -v
    Redis server v=4.0.0 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=c9d8b28825766954
    

    Code (Text):
    systemctl status redis6479
    ● redis6479.service - Redis persistent key-value database
       Loaded: loaded (/usr/lib/systemd/system/redis6479.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/redis6479.service.d
               └─limit.conf
       Active: active (running) since Fri 2017-07-14 19:55:40 UTC; 121ms ago
     Main PID: 14808 (redis-server)
       CGroup: /system.slice/redis6479.service
               └─14808 /etc/redis6479/redis-server 127.0.0.1:6479
    
    Jul 14 19:55:40 centos7.localdomain systemd[1]: Started Redis persistent key-value database.
    Jul 14 19:55:40 centos7.localdomain systemd[1]: Starting Redis persistent key-value database...
    

    Code (Text):
    redis-cli -h 127.0.0.1 -p 6479 info
    # Server
    redis_version:4.0.0
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:c9d8b28825766954
    redis_mode:standalone
    os:Linux 3.10.0-514.26.2.el7.x86_64 x86_64
    arch_bits:64
    multiplexing_api:epoll
    atomicvar_api:atomic-builtin
    gcc_version:4.8.5
    process_id:14808
    run_id:f647eceb48306543f6b585d5a1364c3c2c5d8841
    tcp_port:6479
    uptime_in_seconds:268
    uptime_in_days:0
    hz:10
    lru_clock:6890184
    executable:/etc/redis6479/redis-server
    config_file:/etc/redis6479/redis6479.conf
    
    # Clients
    connected_clients:1
    client_longest_output_list:0
    client_biggest_input_buf:0
    blocked_clients:0
    
    # Memory
    used_memory:828536
    used_memory_human:809.12K
    used_memory_rss:2691072
    used_memory_rss_human:2.57M
    used_memory_peak:828536
    used_memory_peak_human:809.12K
    used_memory_peak_perc:108.21%
    used_memory_overhead:815302
    used_memory_startup:765672
    used_memory_dataset:13234
    used_memory_dataset_perc:21.05%
    total_system_memory:1928650752
    total_system_memory_human:1.80G
    used_memory_lua:37888
    used_memory_lua_human:37.00K
    maxmemory:0
    maxmemory_human:0B
    maxmemory_policy:noeviction
    mem_fragmentation_ratio:3.25
    mem_allocator:jemalloc-4.0.3
    active_defrag_running:0
    lazyfree_pending_objects:0
    
    # Persistence
    loading:0
    rdb_changes_since_last_save:0
    rdb_bgsave_in_progress:0
    rdb_last_save_time:1500062140
    rdb_last_bgsave_status:ok
    rdb_last_bgsave_time_sec:-1
    rdb_current_bgsave_time_sec:-1
    rdb_last_cow_size:0
    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
    aof_last_cow_size:0
    
    # Stats
    total_connections_received:1
    total_commands_processed:0
    instantaneous_ops_per_sec:0
    total_net_input_bytes:14
    total_net_output_bytes:0
    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:0
    keyspace_misses:0
    pubsub_channels:0
    pubsub_patterns:0
    latest_fork_usec:0
    migrate_cached_sockets:0
    slave_expires_tracked_keys:0
    active_defrag_hits:0
    active_defrag_misses:0
    active_defrag_key_hits:0
    active_defrag_key_misses:0
    
    # Replication
    role:master
    connected_slaves:0
    master_replid:e4c672ccf795abecf9e14dddc16291fca490302e
    master_replid2:0000000000000000000000000000000000000000
    master_repl_offset:0
    second_repl_offset:-1
    repl_backlog_active:0
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:0
    repl_backlog_histlen:0
    
    # CPU
    used_cpu_sys:0.14
    used_cpu_user:0.23
    used_cpu_sys_children:0.00
    used_cpu_user_children:0.00
    
    # Cluster
    cluster_enabled:0
    
    # Keyspace
    


    Remi YUM Redis 3.2.9

    Redis 3.2.9 listening on TCP port 6379
    Code (Text):
    /usr/bin/redis-server -v  
    Redis server v=3.2.9 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=a938017dd5f8fcc7
    

    Code (Text):
    systemctl status redis
    ● redis.service - Redis persistent key-value database
       Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/redis.service.d
               └─limit.conf
       Active: active (running) since Fri 2017-07-14 19:53:38 UTC; 3min 4s ago
     Main PID: 14735 (redis-server)
       CGroup: /system.slice/redis.service
               └─14735 /usr/bin/redis-server 127.0.0.1:6379
    
    Jul 14 19:53:38 centos7.localdomain systemd[1]: Started Redis persistent key-value database.
    Jul 14 19:53:38 centos7.localdomain systemd[1]: Starting Redis persistent key-value database...
    

    Code (Text):
    redis-cli info
    # Server
    redis_version:3.2.9
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:a938017dd5f8fcc7
    redis_mode:standalone
    os:Linux 3.10.0-514.26.2.el7.x86_64 x86_64
    arch_bits:64
    multiplexing_api:epoll
    gcc_version:4.8.5
    process_id:14735
    run_id:16336b79481362e66881ae649b605606e3d1d96d
    tcp_port:6379
    uptime_in_seconds:321
    uptime_in_days:0
    hz:10
    lru_clock:6890115
    executable:/usr/bin/redis-server
    config_file:/etc/redis.conf
    
    # Clients
    connected_clients:1
    client_longest_output_list:0
    client_biggest_input_buf:0
    blocked_clients:0
    
    # Memory
    used_memory:813224
    used_memory_human:794.16K
    used_memory_rss:5935104
    used_memory_rss_human:5.66M
    used_memory_peak:813224
    used_memory_peak_human:794.16K
    total_system_memory:1928650752
    total_system_memory_human:1.80G
    used_memory_lua:37888
    used_memory_lua_human:37.00K
    maxmemory:0
    maxmemory_human:0B
    maxmemory_policy:noeviction
    mem_fragmentation_ratio:7.30
    mem_allocator:jemalloc-3.6.0
    
    # Persistence
    loading:0
    rdb_changes_since_last_save:0
    rdb_bgsave_in_progress:0
    rdb_last_save_time:1500062018
    rdb_last_bgsave_status:ok
    rdb_last_bgsave_time_sec:-1
    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:1
    total_commands_processed:0
    instantaneous_ops_per_sec:0
    total_net_input_bytes:14
    total_net_output_bytes:0
    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:0
    keyspace_misses:0
    pubsub_channels:0
    pubsub_patterns:0
    latest_fork_usec:0
    migrate_cached_sockets:0
    
    # 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:0.19
    used_cpu_user:0.32
    used_cpu_sys_children:0.00
    used_cpu_user_children:0.00
    
    # Cluster
    cluster_enabled:0
    
    # Keyspace
    

    Redis Benchmarks



    Compare standalone Redis 3.2.9 vs Redis 4.0 standalone

    redis version set get mset
    redis 3.2.9 6060.61 4901.96 1872.66
    redis 4.0.0 5747.13 5076.14 2109.70


    Code (Text):
    PORTS='6379 6479'
    for PORT in $PORTS; do echo "redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t set -P 1000 -c 100"; redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t set -P 1000 -c 100; done
    

    Code (Text):
    redis-benchmark -h 127.0.0.1 -p 6379 -n 1000 -r 1000 -t set -P 1000 -c 100
    ====== SET ======
      1000 requests completed in 0.17 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 12 milliseconds
    36.50% <= 19 milliseconds
    72.90% <= 20 milliseconds
    100.00% <= 20 milliseconds
    6060.61 requests per second
    
    
    redis-benchmark -h 127.0.0.1 -p 6479 -n 1000 -r 1000 -t set -P 1000 -c 100
    ====== SET ======
      1000 requests completed in 0.17 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 14 milliseconds
    36.50% <= 24 milliseconds
    100.00% <= 24 milliseconds
    5747.13 requests per second
    

    Code (Text):
    PORTS='6379 6479'
    for PORT in $PORTS; do echo "redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t get -P 1000 -c 100"; redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t get -P 1000 -c 100; done
    

    Code (Text):
    redis-benchmark -h 127.0.0.1 -p 6379 -n 1000 -r 1000 -t get -P 1000 -c 100
    ====== GET ======
      1000 requests completed in 0.20 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 10 milliseconds
    45.60% <= 40 milliseconds
    100.00% <= 40 milliseconds
    4901.96 requests per second
    
    
    redis-benchmark -h 127.0.0.1 -p 6479 -n 1000 -r 1000 -t get -P 1000 -c 100
    ====== GET ======
      1000 requests completed in 0.20 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 12 milliseconds
    45.60% <= 35 milliseconds
    100.00% <= 35 milliseconds
    5076.14 requests per second
    

    Code (Text):
    PORTS='6379 6479'
    for PORT in $PORTS; do echo "redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t mset -P 1000 -c 100"; redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t mset -P 1000 -c 100; done
    

    Code (Text):
    redis-benchmark -h 127.0.0.1 -p 6379 -n 1000 -r 1000 -t mset -P 1000 -c 100
    ====== MSET (10 keys) ======
      1000 requests completed in 0.53 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 66 milliseconds
    21.90% <= 67 milliseconds
    56.10% <= 68 milliseconds
    100.00% <= 68 milliseconds
    1872.66 requests per second
    
    
    redis-benchmark -h 127.0.0.1 -p 6479 -n 1000 -r 1000 -t mset -P 1000 -c 100
    ====== MSET (10 keys) ======
      1000 requests completed in 0.47 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 65 milliseconds
    12.10% <= 66 milliseconds
    51.20% <= 67 milliseconds
    100.00% <= 67 milliseconds
    2109.70 requests per second
    
     
    Last edited: Jul 15, 2017
    • Like Like x 1
  3. eva2000

    eva2000 Administrator Staff Member

    30,632
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    11:51 AM
    Nginx 1.13.x
    MariaDB 5.5

    Redis 4.0 Master / Slave Replication



    Setup local Redis 4.0 master/slave replication on TCP ports 6479 (master) and 6480 (slave) + 3x redis sentinel with quorum of 2) tied to master (6479)

    Configured as follows:
    • redis systemd files at /usr/lib/systemd/system/redis6479.service and /usr/lib/systemd/system/redis6480.service
    • redis-server binaries at /etc/redis6479/redis-server and /etc/redis6480/redis-server copied from /usr/local/bin/redis-server (source install) instead of /usr/bin/redis-server
    • redis pid files at /var/run/redis/redis_6479.pid and /var/run/redis/redis_6480.pid
    • dedicated redis config files at /etc/redis6479/redis6479.conf and /etc/redis6479/redis6480.conf
    • each config file will have dbfilename as dump6479.rdb and dump6480.rdb with commented out unix sockets at /var/run/redis/redis6479.sock and /var/run/redis/redis6480.sock
    • dedicated redis data directories at /var/lib/redis6479 and /var/lib/redis6480
    • dedicated redis log files at /var/log/redis/redis6479.log and /var/log/redis/redis6480.log
    • sentinel config file /root/tools/redis-sentinel/sentinel-16479.conf where STARTPORT is 6479 and incremented by 2 for /root/tools/redis-sentinel/sentinel-16480.conf and /root/tools/redis-sentinel/sentinel-16481.conf
    • sentinel port is STARTPORT + 10000 = 6479 + 10000 = 16479 and incremented by 2 for 16480 and 16481
    • sentinel init.d startup script is at /etc/init.d/sentinel_16479 and incremented by 2 for /etc/init.d/sentinel_16480 and /etc/init.d/sentinel_16481
    • sentinel directory /var/lib/redis/sentinel_16479, /var/lib/redis/sentinel_16480 and /var/lib/redis/sentinel_16481
    • sentinel log /var/log/redis/sentinel-16479.log, /var/log/redis/sentinel-16480.log and /var/log/redis/sentinel-16481.log
    • sentinel pid file /var/run/redis/redis-sentinel-16479.pid, /var/run/redis/redis-sentinel-16480.pid and /var/run/redis/redis-sentinel-16481.pid
    • quorum is set to 2 with 3x redis sentinels
    Code (Text):
    /etc/redis6479/redis-server -v
    Redis server v=4.0.0 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=269fa3414af1c24f
    
    /etc/redis6480/redis-server -v
    Redis server v=4.0.0 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=269fa3414af1c24f
    

    Code (Text):
    ps aufxw | grep redis | grep -v grep
    redis    10794  0.2  0.3 142892  5796 ?        Ssl  20:14   0:01 /usr/bin/redis-server 127.0.0.1:6379
    redis    15557  0.2  0.1 147288  2816 ?        Ssl  20:25   0:00 /etc/redis6479/redis-server 127.0.0.1:6479
    root     15625  0.5  0.1  41652  2340 ?        Ssl  20:25   0:00 /etc/redis6479/redis-server *:16479 [sentinel]
    root     15673  0.5  0.1  41652  2328 ?        Ssl  20:25   0:00 /etc/redis6479/redis-server *:16480 [sentinel]
    root     15721  0.3  0.1  41652  2268 ?        Ssl  20:25   0:00 /etc/redis6479/redis-server *:16481 [sentinel]
    redis    15773  0.5  0.1 147288  2696 ?        Ssl  20:25   0:00 /etc/redis6480/redis-server 127.0.0.1:6480
    

    Code (Text):
    /usr/local/bin/redis-cli -h 127.0.0.1 -p 6479 INFO
    # Server
    redis_version:4.0.0
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:269fa3414af1c24f
    redis_mode:standalone
    os:Linux 3.10.0-514.26.2.el7.x86_64 x86_64
    arch_bits:64
    multiplexing_api:epoll
    atomicvar_api:atomic-builtin
    gcc_version:4.8.5
    process_id:15557
    run_id:290bedce2c783b9d7eec67e12a78261ea9f78236
    tcp_port:6479
    uptime_in_seconds:114
    uptime_in_days:0
    hz:10
    lru_clock:6891826
    executable:/etc/redis6479/redis-server
    config_file:/etc/redis6479/redis6479.conf
    
    # Clients
    connected_clients:7
    client_longest_output_list:0
    client_biggest_input_buf:0
    blocked_clients:0
    
    # Memory
    used_memory:2023000
    used_memory_human:1.93M
    used_memory_rss:2883584
    used_memory_rss_human:2.75M
    used_memory_peak:2123912
    used_memory_peak_human:2.03M
    used_memory_peak_perc:95.25%
    used_memory_overhead:1981884
    used_memory_startup:765672
    used_memory_dataset:41116
    used_memory_dataset_perc:3.27%
    total_system_memory:1928650752
    total_system_memory_human:1.80G
    used_memory_lua:37888
    used_memory_lua_human:37.00K
    maxmemory:0
    maxmemory_human:0B
    maxmemory_policy:noeviction
    mem_fragmentation_ratio:1.43
    mem_allocator:jemalloc-4.0.3
    active_defrag_running:0
    lazyfree_pending_objects:0
    
    # Persistence
    loading:0
    rdb_changes_since_last_save:0
    rdb_bgsave_in_progress:0
    rdb_last_save_time:1500063945
    rdb_last_bgsave_status:ok
    rdb_last_bgsave_time_sec:0
    rdb_current_bgsave_time_sec:-1
    rdb_last_cow_size:217088
    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
    aof_last_cow_size:0
    
    # Stats
    total_connections_received:10
    total_commands_processed:630
    instantaneous_ops_per_sec:7
    total_net_input_bytes:31081
    total_net_output_bytes:183508
    instantaneous_input_kbps:0.35
    instantaneous_output_kbps:2.72
    rejected_connections:0
    sync_full:1
    sync_partial_ok:0
    sync_partial_err:0
    expired_keys:0
    evicted_keys:0
    keyspace_hits:0
    keyspace_misses:0
    pubsub_channels:1
    pubsub_patterns:0
    latest_fork_usec:135
    migrate_cached_sockets:0
    slave_expires_tracked_keys:0
    active_defrag_hits:0
    active_defrag_misses:0
    active_defrag_key_hits:0
    active_defrag_key_misses:0
    
    # Replication
    role:master
    connected_slaves:1
    slave0:ip=127.0.0.1,port=6480,state=online,offset=20985,lag=0
    master_replid:62110e54ecc48592cc27d6474ffa913d40b503cc
    master_replid2:0000000000000000000000000000000000000000
    master_repl_offset:20985
    second_repl_offset:-1
    repl_backlog_active:1
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:1
    repl_backlog_histlen:20985
    
    # CPU
    used_cpu_sys:0.18
    used_cpu_user:0.26
    used_cpu_sys_children:0.00
    used_cpu_user_children:0.00
    
    # Cluster
    cluster_enabled:0
    
    # Keyspace
    

    Code (Text):
    /usr/local/bin/redis-cli -h 127.0.0.1 -p 6480 INFO
    # Server
    redis_version:4.0.0
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:269fa3414af1c24f
    redis_mode:standalone
    os:Linux 3.10.0-514.26.2.el7.x86_64 x86_64
    arch_bits:64
    multiplexing_api:epoll
    atomicvar_api:atomic-builtin
    gcc_version:4.8.5
    process_id:15773
    run_id:f8ac7fdf44a076e31d91229a1cf243e8f00f8aa6
    tcp_port:6480
    uptime_in_seconds:132
    uptime_in_days:0
    hz:10
    lru_clock:6891853
    executable:/etc/redis6480/redis-server
    config_file:/etc/redis6480/redis6480.conf
    
    # Clients
    connected_clients:8
    client_longest_output_list:0
    client_biggest_input_buf:0
    blocked_clients:0
    
    # Memory
    used_memory:2023336
    used_memory_human:1.93M
    used_memory_rss:2760704
    used_memory_rss_human:2.63M
    used_memory_peak:2124296
    used_memory_peak_human:2.03M
    used_memory_peak_perc:95.25%
    used_memory_overhead:1981900
    used_memory_startup:765688
    used_memory_dataset:41436
    used_memory_dataset_perc:3.29%
    total_system_memory:1928650752
    total_system_memory_human:1.80G
    used_memory_lua:37888
    used_memory_lua_human:37.00K
    maxmemory:0
    maxmemory_human:0B
    maxmemory_policy:noeviction
    mem_fragmentation_ratio:1.36
    mem_allocator:jemalloc-4.0.3
    active_defrag_running:0
    lazyfree_pending_objects:0
    
    # Persistence
    loading:0
    rdb_changes_since_last_save:0
    rdb_bgsave_in_progress:0
    rdb_last_save_time:1500063945
    rdb_last_bgsave_status:ok
    rdb_last_bgsave_time_sec:-1
    rdb_current_bgsave_time_sec:-1
    rdb_last_cow_size:0
    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
    aof_last_cow_size:0
    
    # Stats
    total_connections_received:9
    total_commands_processed:806
    instantaneous_ops_per_sec:6
    total_net_input_bytes:57619
    total_net_output_bytes:271717
    instantaneous_input_kbps:0.54
    instantaneous_output_kbps:1.53
    rejected_connections:0
    sync_full:0
    sync_partial_ok:0
    sync_partial_err:0
    expired_keys:0
    evicted_keys:0
    keyspace_hits:0
    keyspace_misses:0
    pubsub_channels:1
    pubsub_patterns:0
    latest_fork_usec:0
    migrate_cached_sockets:0
    slave_expires_tracked_keys:0
    active_defrag_hits:0
    active_defrag_misses:0
    active_defrag_key_hits:0
    active_defrag_key_misses:0
    
    # Replication
    role:slave
    master_host:127.0.0.1
    master_port:6479
    master_link_status:up
    master_last_io_seconds_ago:0
    master_sync_in_progress:0
    slave_repl_offset:26317
    slave_priority:100
    slave_read_only:1
    connected_slaves:0
    master_replid:62110e54ecc48592cc27d6474ffa913d40b503cc
    master_replid2:0000000000000000000000000000000000000000
    master_repl_offset:26317
    second_repl_offset:-1
    repl_backlog_active:1
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:1
    repl_backlog_histlen:26317
    
    # CPU
    used_cpu_sys:0.21
    used_cpu_user:0.34
    used_cpu_sys_children:0.00
    used_cpu_user_children:0.00
    
    # Cluster
    cluster_enabled:0
    
    # Keyspace
    

    Redis 4.0 replication master log
    Code (Text):
    tail -1000 /var/log/redis/redis6479.log
    15557:C 14 Jul 20:25:36.784 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    15557:C 14 Jul 20:25:36.784 # Redis version=4.0.0, bits=64, commit=00000000, modified=0, pid=15557, just started
    15557:C 14 Jul 20:25:36.784 # Configuration loaded
    15557:M 14 Jul 20:25:36.787 * Running mode=standalone, port=6479.
    15557:M 14 Jul 20:25:36.787 # Server initialized
    15557:M 14 Jul 20:25:36.787 * Ready to accept connections
    15557:M 14 Jul 20:25:45.503 * Slave 127.0.0.1:6480 asks for synchronization
    15557:M 14 Jul 20:25:45.503 * Full resync requested by slave 127.0.0.1:6480
    15557:M 14 Jul 20:25:45.503 * Starting BGSAVE for SYNC with target: disk
    15557:M 14 Jul 20:25:45.503 * Background saving started by pid 15777
    15777:C 14 Jul 20:25:45.526 * DB saved on disk
    15777:C 14 Jul 20:25:45.526 * RDB: 0 MB of memory used by copy-on-write
    15557:M 14 Jul 20:25:45.557 * Background saving terminated with success
    15557:M 14 Jul 20:25:45.558 * Synchronization with slave 127.0.0.1:6480 succeeded
    

    Redis 4.0 replication slave log
    Code (Text):
    tail -1000 /var/log/redis/redis6480.log
    15773:C 14 Jul 20:25:45.499 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    15773:C 14 Jul 20:25:45.500 # Redis version=4.0.0, bits=64, commit=00000000, modified=0, pid=15773, just started
    15773:C 14 Jul 20:25:45.500 # Configuration loaded
    15773:S 14 Jul 20:25:45.502 * Running mode=standalone, port=6480.
    15773:S 14 Jul 20:25:45.502 # Server initialized
    15773:S 14 Jul 20:25:45.502 * Ready to accept connections
    15773:S 14 Jul 20:25:45.502 * Connecting to MASTER 127.0.0.1:6479
    15773:S 14 Jul 20:25:45.502 * MASTER <-> SLAVE sync started
    15773:S 14 Jul 20:25:45.502 * Non blocking connect for SYNC fired the event.
    15773:S 14 Jul 20:25:45.502 * Master replied to PING, replication can continue...
    15773:S 14 Jul 20:25:45.503 * Partial resynchronization not possible (no cached master)
    15773:S 14 Jul 20:25:45.503 * Full resync from master: 62110e54ecc48592cc27d6474ffa913d40b503cc:0
    15773:S 14 Jul 20:25:45.558 * MASTER <-> SLAVE sync: receiving 175 bytes from master
    15773:S 14 Jul 20:25:45.558 * MASTER <-> SLAVE sync: Flushing old data
    15773:S 14 Jul 20:25:45.558 * MASTER <-> SLAVE sync: Loading DB in memory
    15773:S 14 Jul 20:25:45.558 * MASTER <-> SLAVE sync: Finished with success
    

    Redis 4.0 replication sentinel log for TCP 16479
    Code (Text):
    tail -1000 /var/log/redis/sentinel-16479.log
    15620:X 14 Jul 20:25:39.044 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    15620:X 14 Jul 20:25:39.044 # Redis version=4.0.0, bits=64, commit=00000000, modified=0, pid=15620, just started
    15620:X 14 Jul 20:25:39.044 # Configuration loaded
    15625:X 14 Jul 20:25:39.046 * Running mode=sentinel, port=16479.
    15625:X 14 Jul 20:25:39.059 # Sentinel ID is 10e60db015c9750647560096bcb7e94e634b7ccd
    15625:X 14 Jul 20:25:39.059 # +monitor master master-6479 127.0.0.1 6479 quorum 2
    15625:X 14 Jul 20:25:43.223 * +sentinel sentinel 88d8236c5dc5eace0f92458ad828be4e63aae715 127.0.0.1 16480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:25:45.382 * +sentinel sentinel 292bf58b986c4c36699eb35efd1de36c8c7ba307 127.0.0.1 16481 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:25:49.140 * +slave slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    

    Simulate Redis master on port 6479 failure
    Code (Text):
    kill -9 $(cat /var/run/redis/redis_6479.pid)
    

    Code (Text):
    redis-cli -h 127.0.0.1 -p 6479 INFO REPLICATION
    Could not connect to Redis at 127.0.0.1:6479: Connection refused
    

    Check replication info for promoted redis slave 6480 to master where role = master
    Code (Text):
    redis-cli -h 127.0.0.1 -p 6480 INFO REPLICATION
    # Replication
    role:master
    connected_slaves:0
    master_replid:ec956cf16814ac18d3e705bb3adece5fe04fe4e4
    master_replid2:62110e54ecc48592cc27d6474ffa913d40b503cc
    master_repl_offset:102446
    second_repl_offset:95760
    repl_backlog_active:1
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:1
    repl_backlog_histlen:102446
    

    Checking sentinel #1 log on port 16479
    Code (Text):
    tail -50 /var/log/redis/sentinel-16479.log
    15620:X 14 Jul 20:25:39.044 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    15620:X 14 Jul 20:25:39.044 # Redis version=4.0.0, bits=64, commit=00000000, modified=0, pid=15620, just started
    15620:X 14 Jul 20:25:39.044 # Configuration loaded
    15625:X 14 Jul 20:25:39.046 * Running mode=sentinel, port=16479.
    15625:X 14 Jul 20:25:39.059 # Sentinel ID is 10e60db015c9750647560096bcb7e94e634b7ccd
    15625:X 14 Jul 20:25:39.059 # +monitor master master-6479 127.0.0.1 6479 quorum 2
    15625:X 14 Jul 20:25:43.223 * +sentinel sentinel 88d8236c5dc5eace0f92458ad828be4e63aae715 127.0.0.1 16480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:25:45.382 * +sentinel sentinel 292bf58b986c4c36699eb35efd1de36c8c7ba307 127.0.0.1 16481 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:25:49.140 * +slave slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.580 # +sdown master master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.663 # +odown master master-6479 127.0.0.1 6479 #quorum 2/2
    15625:X 14 Jul 20:33:49.664 # +new-epoch 1
    15625:X 14 Jul 20:33:49.664 # +try-failover master master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.667 # +vote-for-leader 10e60db015c9750647560096bcb7e94e634b7ccd 1
    15625:X 14 Jul 20:33:49.675 # 292bf58b986c4c36699eb35efd1de36c8c7ba307 voted for 10e60db015c9750647560096bcb7e94e634b7ccd 1
    15625:X 14 Jul 20:33:49.675 # 88d8236c5dc5eace0f92458ad828be4e63aae715 voted for 10e60db015c9750647560096bcb7e94e634b7ccd 1
    15625:X 14 Jul 20:33:49.730 # +elected-leader master master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.730 # +failover-state-select-slave master master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.822 # +selected-slave slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.822 * +failover-state-send-slaveof-noone slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.888 * +failover-state-wait-promotion slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:50.691 # +promoted-slave slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:50.691 # +failover-state-reconf-slaves master master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:50.790 # +failover-end master master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:50.791 # +switch-master master-6479 127.0.0.1 6479 127.0.0.1 6480
    15625:X 14 Jul 20:33:50.791 * +slave slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    15625:X 14 Jul 20:33:53.808 # +sdown slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    

    Checking sentinel #2 log on port 16480
    Code (Text):
    tail -50 /var/log/redis/sentinel-16480.log
    15668:X 14 Jul 20:25:41.168 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    15668:X 14 Jul 20:25:41.168 # Redis version=4.0.0, bits=64, commit=00000000, modified=0, pid=15668, just started
    15668:X 14 Jul 20:25:41.168 # Configuration loaded
    15673:X 14 Jul 20:25:41.171 * Running mode=sentinel, port=16480.
    15673:X 14 Jul 20:25:41.174 # Sentinel ID is 88d8236c5dc5eace0f92458ad828be4e63aae715
    15673:X 14 Jul 20:25:41.174 # +monitor master master-6479 127.0.0.1 6479 quorum 2
    15673:X 14 Jul 20:25:43.156 * +sentinel sentinel 10e60db015c9750647560096bcb7e94e634b7ccd 127.0.0.1 16479 @ master-6479 127.0.0.1 6479
    15673:X 14 Jul 20:25:45.382 * +sentinel sentinel 292bf58b986c4c36699eb35efd1de36c8c7ba307 127.0.0.1 16481 @ master-6479 127.0.0.1 6479
    15673:X 14 Jul 20:25:51.189 * +slave slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15673:X 14 Jul 20:33:49.616 # +sdown master master-6479 127.0.0.1 6479
    15673:X 14 Jul 20:33:49.672 # +new-epoch 1
    15673:X 14 Jul 20:33:49.674 # +vote-for-leader 10e60db015c9750647560096bcb7e94e634b7ccd 1
    15673:X 14 Jul 20:33:49.675 # +odown master master-6479 127.0.0.1 6479 #quorum 3/2
    15673:X 14 Jul 20:33:49.675 # Next failover delay: I will not start a failover before Fri Jul 14 20:34:01 2017
    15673:X 14 Jul 20:33:50.793 # +config-update-from sentinel 10e60db015c9750647560096bcb7e94e634b7ccd 127.0.0.1 16479 @ master-6479 127.0.0.1 6479
    15673:X 14 Jul 20:33:50.793 # +switch-master master-6479 127.0.0.1 6479 127.0.0.1 6480
    15673:X 14 Jul 20:33:50.793 * +slave slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    15673:X 14 Jul 20:33:53.834 # +sdown slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    

    Checking sentinel #3 log on port 16481
    Code (Text):
    tail -50 /var/log/redis/sentinel-16481.log
    15716:X 14 Jul 20:25:43.301 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    15716:X 14 Jul 20:25:43.302 # Redis version=4.0.0, bits=64, commit=00000000, modified=0, pid=15716, just started
    15716:X 14 Jul 20:25:43.302 # Configuration loaded
    15721:X 14 Jul 20:25:43.303 * Running mode=sentinel, port=16481.
    15721:X 14 Jul 20:25:43.309 # Sentinel ID is 292bf58b986c4c36699eb35efd1de36c8c7ba307
    15721:X 14 Jul 20:25:43.309 # +monitor master master-6479 127.0.0.1 6479 quorum 2
    15721:X 14 Jul 20:25:45.202 * +sentinel sentinel 10e60db015c9750647560096bcb7e94e634b7ccd 127.0.0.1 16479 @ master-6479 127.0.0.1 6479
    15721:X 14 Jul 20:25:45.298 * +sentinel sentinel 88d8236c5dc5eace0f92458ad828be4e63aae715 127.0.0.1 16480 @ master-6479 127.0.0.1 6479
    15721:X 14 Jul 20:25:53.370 * +slave slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15721:X 14 Jul 20:33:49.553 # +sdown master master-6479 127.0.0.1 6479
    15721:X 14 Jul 20:33:49.672 # +new-epoch 1
    15721:X 14 Jul 20:33:49.674 # +vote-for-leader 10e60db015c9750647560096bcb7e94e634b7ccd 1
    15721:X 14 Jul 20:33:50.653 # +odown master master-6479 127.0.0.1 6479 #quorum 3/2
    15721:X 14 Jul 20:33:50.654 # Next failover delay: I will not start a failover before Fri Jul 14 20:34:01 2017
    15721:X 14 Jul 20:33:50.793 # +config-update-from sentinel 10e60db015c9750647560096bcb7e94e634b7ccd 127.0.0.1 16479 @ master-6479 127.0.0.1 6479
    15721:X 14 Jul 20:33:50.793 # +switch-master master-6479 127.0.0.1 6479 127.0.0.1 6480
    15721:X 14 Jul 20:33:50.793 * +slave slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    15721:X 14 Jul 20:33:53.815 # +sdown slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    

    Restart Redis 6479 port instance
    Code (Text):
    systemctl start redis6479
    

    Redis 6479 role = slave
    Code (Text):
    redis-cli -h 127.0.0.1 -p 6479 INFO REPLICATION
    # Replication
    role:slave
    master_host:127.0.0.1
    master_port:6480
    master_link_status:up
    master_last_io_seconds_ago:0
    master_sync_in_progress:0
    slave_repl_offset:171758
    slave_priority:100
    slave_read_only:1
    connected_slaves:0
    master_replid:ec956cf16814ac18d3e705bb3adece5fe04fe4e4
    master_replid2:62110e54ecc48592cc27d6474ffa913d40b503cc
    master_repl_offset:0
    second_repl_offset:1
    repl_backlog_active:0
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:0
    repl_backlog_histlen:0
    

    Redis 6480 role = master
    Code (Text):
    redis-cli -h 127.0.0.1 -p 6480 INFO REPLICATION
    # Replication
    role:master
    connected_slaves:1
    slave0:ip=127.0.0.1,port=6479,state=online,offset=178886,lag=0
    master_replid:ec956cf16814ac18d3e705bb3adece5fe04fe4e4
    master_replid2:62110e54ecc48592cc27d6474ffa913d40b503cc
    master_repl_offset:178886
    second_repl_offset:95760
    repl_backlog_active:1
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:1
    repl_backlog_histlen:178886
    

    Sentinel log at /var/log/redis/sentinel-16479.log
    Code (Text):
    tail -10 /var/log/redis/sentinel-16479.log    
    15625:X 14 Jul 20:33:49.822 # +selected-slave slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.822 * +failover-state-send-slaveof-noone slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:49.888 * +failover-state-wait-promotion slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:50.691 # +promoted-slave slave 127.0.0.1:6480 127.0.0.1 6480 @ master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:50.691 # +failover-state-reconf-slaves master master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:50.790 # +failover-end master master-6479 127.0.0.1 6479
    15625:X 14 Jul 20:33:50.791 # +switch-master master-6479 127.0.0.1 6479 127.0.0.1 6480
    15625:X 14 Jul 20:33:50.791 * +slave slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    15625:X 14 Jul 20:33:53.808 # +sdown slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    15625:X 14 Jul 20:37:16.051 # -sdown slave 127.0.0.1:6479 127.0.0.1 6479 @ master-6479 127.0.0.1 6480
    


    Redis Benchmarks



    Compare standalone Redis 3.2.9 vs Redis 4.0 replication master/slave. Replication usually would be slower due to writes to slave.

    redis version set get mset
    redis 3.2.9 6289.31 5208.33 1697.79
    redis 4.0.0 3968.25 4484.30 873.36


    Code (Text):
    PORTS='6379 6479'
    for PORT in $PORTS; do echo "redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t set -P 1000 -c 100"; redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t set -P 1000 -c 100; done
    

    Code (Text):
    redis-benchmark -h 127.0.0.1 -p 6379 -n 1000 -r 1000 -t set -P 1000 -c 100
    ====== SET ======
      1000 requests completed in 0.16 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 12 milliseconds
    36.50% <= 19 milliseconds
    72.90% <= 20 milliseconds
    100.00% <= 20 milliseconds
    6289.31 requests per second
    
    
    redis-benchmark -h 127.0.0.1 -p 6479 -n 1000 -r 1000 -t set -P 1000 -c 100
    ====== SET ======
      1000 requests completed in 0.25 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 20 milliseconds
    36.50% <= 43 milliseconds
    100.00% <= 43 milliseconds
    3968.25 requests per second
    

    Code (Text):
    PORTS='6379 6479'
    for PORT in $PORTS; do echo "redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t get -P 1000 -c 100"; redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t get -P 1000 -c 100; done
    

    Code (Text):
    redis-benchmark -h 127.0.0.1 -p 6379 -n 1000 -r 1000 -t get -P 1000 -c 100
    ====== GET ======
      1000 requests completed in 0.19 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 10 milliseconds
    45.60% <= 34 milliseconds
    100.00% <= 34 milliseconds
    5208.33 requests per second
    
    
    redis-benchmark -h 127.0.0.1 -p 6479 -n 1000 -r 1000 -t get -P 1000 -c 100
    ====== GET ======
      1000 requests completed in 0.22 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 10 milliseconds
    45.60% <= 41 milliseconds
    100.00% <= 41 milliseconds
    4484.30 requests per second
    

    Code (Text):
    PORTS='6379 6479'
    for PORT in $PORTS; do echo "redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t mset -P 1000 -c 100"; redis-benchmark -h 127.0.0.1 -p $PORT -n 1000 -r 1000 -t mset -P 1000 -c 100; done
    

    Code (Text):
    redis-benchmark -h 127.0.0.1 -p 6379 -n 1000 -r 1000 -t mset -P 1000 -c 100
    ====== MSET (10 keys) ======
      1000 requests completed in 0.59 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 95 milliseconds
    21.90% <= 97 milliseconds
    100.00% <= 97 milliseconds
    1697.79 requests per second
    
    
    redis-benchmark -h 127.0.0.1 -p 6479 -n 1000 -r 1000 -t mset -P 1000 -c 100
    ====== MSET (10 keys) ======
      1000 requests completed in 1.14 seconds
      100 parallel clients
      3 bytes payload
      keep alive: 1
    
    0.10% <= 66 milliseconds
    7.40% <= 69 milliseconds
    26.90% <= 70 milliseconds
    46.40% <= 71 milliseconds
    100.00% <= 71 milliseconds
    873.36 requests per second
    
     
    Last edited: Jul 15, 2017
    • Informative Informative x 3
  4. eva2000

    eva2000 Administrator Staff Member

    30,632
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    11:51 AM
    Nginx 1.13.x
    MariaDB 5.5

    Redis 4.0 Replication PSYNC2



    From The first release candidate of Redis 4.0 is out - <antirez>

     
Thread Status:
Not open for further replies.