apache / kvrocks

Apache Kvrocks is a distributed key value NoSQL database that uses RocksDB as storage engine and is compatible with Redis protocol.
https://kvrocks.apache.org/
Apache License 2.0
3.47k stars 450 forks source link

[QUESTION]slaveof field accept ip only? #292

Closed hellower closed 3 years ago

hellower commented 3 years ago

I have configured kvrocks master and slave on one server. master kvrocks port : 9188 slave kvrocks port: 9288

In the slave's configuration file. If I put hostname instead of ip in "slaveof field", an error occurs.

but Redis works fine with both ip and hostname in slaveof field.

##################################################### kvrocks.conf of slave ............... slavof localhost 9188 ...............

SLAVE$ ./kvrocks -c kvrocks.conf Version: 999.999.999 @0daf3b5e E0603 09:06:30.111851 5138 replication.cc:214] [replication] Failed to start state machine, err: Network is unreachable <====== ERROR!

#################################################### kvrocks.conf of slave ............... slavof 127.0.0.1 9188 ............... SLAVE$ ./kvrocks -c kvrocks.conf Version: 999.999.999 @0daf3b5e <====== works good!

cf. STAGE$ ping localhost PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.031 ms 64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.041 ms 64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.052 ms

git-hulk commented 3 years ago

cool, thanks for finding out about this issue, do you want to create a PR to fix it?