redis集群

单一主从(一般不这么用)
    slaveof 127.0.0.1 6379
    info replication

    # Replication
    role:slave
    master_host:127.0.0.1
    master_port:6379
    master_link_status:up
    master_last_io_seconds_ago:6
    master_sync_in_progress:0
    slave_repl_offset:462
    slave_priority:100
    slave_read_only:1
    connected_slaves:0
    master_replid:201640b5a63c036087b7a459245a6f6a699b8a36
    master_replid2:0000000000000000000000000000000000000000
    master_repl_offset:462
    second_repl_offset:-1
    repl_backlog_active:1
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:1
    repl_backlog_histlen:462
--------------------------------------------------------------------------------
修改配置
    #bind 127.0.01
    protect-mode no
    daemonize yes
    masterauth libo510723
    requirepass libo510723
    appendonly yes
    cluster-enabled yes
    cluster-config-file nodes-6379.conf
    cluster-node-timeout 15000
--------------------------------------------------------------------------------
集群的坑
You can't have keys in a DB different than DB 0 when in Cluster mode. Exiting.
    aof文件修改一个名字

(error)LOADING Redis is loading the dataset in memory
    清空flushdb

Waiting for the cluster to join 一直等待
    打开各自端口+10000的redis端口总线
    自己服务的bind设置为公网ip再启动redis-server
    src/redis-cli --cluster create 10.10.89.43:6379 10.10.89.45:6379 10.10.93.247:6379 -a libo510723

(error) MOVED 866 10.10.89.43:6379
    redis-cli 加上 -c 参数就可以在其他机器get key了
--------------------------------------------------------------------------------
添加节点(把新节点添加到已存在的一个节点上即可)
    src/redis-cli --cluster add-node 10.10.93.247:6380 10.10.89.43:6379

你可能感兴趣的:(中间件)