1

**Tried below code but it gives error had updated

  • 'tcp://127.0.0.1:6379' => No connections available in the pool
  • 'tcp://127.0.0.1:7000' => "MOVED 13116 127.0.0.1:7002
  • In one scenario it gives CLUSTERDOWN Hash not served**

Unable to resolve this three issues. If i update conf file cluster-enable to "no" 3 issue is resolved but unable to resolve 1-2 issues due to which i am unable to connect via predis

it works if i try redis-cli -p 7000

 try {
        
        //$this->redis_cluster_connection();
        if (empty($this->redis_cluster)) {
            $params = ["tcp://127.0.0.1:7001" ,"tcp://127.0.0.1:7000" ,"tcp://127.0.0.1:7002" ,];
            $params = array(
                'tcp://127.0.0.1:7000',
                'tcp://127.0.0.1:7001',
                'tcp://127.0.0.1:7002',
                'tcp://127.0.0.1:7003',
                'tcp://127.0.0.1:7004',
                'tcp://127.0.0.1:7005',
                'tcp://127.0.0.1:6379',
            );
            $params = 'tcp://127.0.0.1:6379';
            $options = ["cluster"   => "redis",];
            $this->redis_cluster = new Predis\Client($params, $options);            
        }
        return $this->redis_cluster->get($key);
    } catch (RedisException $ex) {
        throw new RedisException($ex->getMessage(), (int) $ex->getCode());
    }

**Steps followed from my side** 


sudo redis-server /var/redis/cluster-test/7001/7001.conf & 

Same goes for rest server from 7000 to 7005

Then

redis-cli --cluster create 127.0.0.1:7000 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  --cluster-replicas 1


>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 127.0.0.1:7004 to 127.0.0.1:7000
Adding replica 127.0.0.1:7005 to 127.0.0.1:7001
Adding replica 127.0.0.1:7003 to 127.0.0.1:7002
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: 7a413ab8f0644dc902ea0ab0bdeeabb664d1da1a 127.0.0.1:7000
   slots:[0-5460] (5461 slots) master
M: 4802dd8438a6a84778337be152f2ad6669901979 127.0.0.1:7001
   slots:[5461-10922] (5462 slots) master
M: 1462e3c24b35a2866ed3d2a5e22143ea9acf8e3e 127.0.0.1:7002
   slots:[10923-16383] (5461 slots) master
S: 9fed23f2836ac3503c5c982cb1aaa4fb4556361d 127.0.0.1:7003
   replicates 1462e3c24b35a2866ed3d2a5e22143ea9acf8e3e
S: ab6b3fd13a07b5c7f0853c69e76fee73d35cb9e8 127.0.0.1:7004
   replicates 7a413ab8f0644dc902ea0ab0bdeeabb664d1da1a
S: 4ebb578835b6d9e23b22497ee71731aff3a13977 127.0.0.1:7005
   replicates 4802dd8438a6a84778337be152f2ad6669901979
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
..
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: 7a413ab8f0644dc902ea0ab0bdeeabb664d1da1a 127.0.0.1:7000
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: 9fed23f2836ac3503c5c982cb1aaa4fb4556361d 127.0.0.1:7003
   slots: (0 slots) slave
   replicates 1462e3c24b35a2866ed3d2a5e22143ea9acf8e3e
S: ab6b3fd13a07b5c7f0853c69e76fee73d35cb9e8 127.0.0.1:7004
   slots: (0 slots) slave
   replicates 7a413ab8f0644dc902ea0ab0bdeeabb664d1da1a
M: 1462e3c24b35a2866ed3d2a5e22143ea9acf8e3e 127.0.0.1:7002
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
S: 4ebb578835b6d9e23b22497ee71731aff3a13977 127.0.0.1:7005
   slots: (0 slots) slave
   replicates 4802dd8438a6a84778337be152f2ad6669901979
M: 4802dd8438a6a84778337be152f2ad6669901979 127.0.0.1:7001
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

Tried below links to resolve above issues No connections available in the pool, Laravel and Redis Redis Server Cluster Not Working

insoftservice
  • 820
  • 8
  • 15

0 Answers0