Creating cluster [ERR] Node 127.0.0.1:7001 is not configured as a cluster node.

今天在虚拟机中的ubantu中,配置集群,报了这个错。在网上找了半天,才找到个有点关系的。

http://grokbase.com/t/gg/redis-db/15492gz7j4/cluster-setup

,大体意思是说配置文件没有配置好。自己只好把6个配置文件来来回回看了好几遍。结果真看出来有好几个地方没有去掉注释。

确认无误后,重启系统:

1.启动redis实例:


2.测试是否成功:



第三个截图里面比我一开始多了,127.0.0.1:17xxx这6个。

3.创建并启动集群:

redis-trib.rb  create  --replicas  1  127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006
>>> Creating cluster
[ERR] Node 127.0.0.1:7001 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
报了个错,这个错过段时间再看什么原因。

4.客户端连接集群:

 redis-cli -c -h 127.0.0.1 -p 7001
127.0.0.1:7001> info
# Server
redis_version:4.0.1
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:c2421362bb182556
redis_mode:cluster
os:Linux 4.8.0-36-generic x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:5.4.0
process_id:2281
run_id:52d913baa483a08bb2b9aab5d16722a4dad7682c
tcp_port:7001
uptime_in_seconds:105
uptime_in_days:0
hz:10
lru_clock:9441446
executable:/home/sa/Downloads/redis-4.0.1/src/redis-server
config_file:/home/sa/Downloads/redis-cluster/7001/redis.conf

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:2621712
used_memory_human:2.50M
used_memory_rss:13803520
used_memory_rss_human:13.16M
used_memory_peak:2622736
used_memory_peak_human:2.50M
used_memory_peak_perc:99.96%
used_memory_overhead:2552496
used_memory_startup:1437432
used_memory_dataset:69216
used_memory_dataset_perc:5.84%
total_system_memory:2077257728
total_system_memory_human:1.93G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
mem_fragmentation_ratio:5.26
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:1502613566
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:0
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:6537216
aof_enabled:1
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
aof_current_size:0
aof_base_size:0
aof_pending_rewrite:0
aof_buffer_length:0
aof_rewrite_buffer_length:0
aof_pending_bio_fsync:0
aof_delayed_fsync:0

# Stats
total_connections_received:3
total_commands_processed:113
instantaneous_ops_per_sec:1
total_net_input_bytes:3880
total_net_output_bytes:15076
instantaneous_input_kbps:0.04
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:1
sync_partial_ok:0
sync_partial_err:1
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:1563
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=7004,state=online,offset=140,lag=0
master_replid:6159bfd6d6502db45adaafd137b094028e532e03
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:140
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:140

# CPU
used_cpu_sys:0.21
used_cpu_user:0.12
used_cpu_sys_children:0.00
used_cpu_user_children:0.00

# Cluster
cluster_enabled:1

# Keyspace
127.0.0.1:7001> 
root@ubuntu:/home/sa/Downloads/redis-4.0.1/src# 

看样子是可以了,继续。

4.测试:


发布了140 篇原创文章 · 获赞 32 · 访问量 31万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览