aprice- / redisclustercompose

Redis cluster using docker compose compatible with --scale argument
64 stars 28 forks source link

getting the following when trying to deploy as part of a stack #7

Open josephderonde opened 5 years ago

josephderonde commented 5 years ago

docker: Error response from daemon: Could not attach to network test_default: rpc error: code = PermissionDenied desc = network test_default not manually attachable.

Relevant part of my compose file:

basket_data: command: --cluster-enabled yes --bind 0.0.0.0 --loglevel warning ports:

This is deployed with the command docker stack deploy --compose-file docker-compose.yml --compose-file docker-compose.dev.yml --with-registry-auth --prune Test

I have renamed the project to Test

any help would be appreciated

Many Thanks Joe.

josephderonde commented 5 years ago

I have managed to resolve this issue

networks: default: driver: overlay attachable: true

New issue has now become apparent:

Successfully installed redis-4.1.0 1 gem installed --2019-02-18 12:22:22-- http://download.redis.io/redis-stable/src/redis-trib.rb Resolving download.redis.io (download.redis.io)... 109.74.203.151 Connecting to download.redis.io (download.redis.io)|109.74.203.151|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 3600 (3.5K) [text/plain] Saving to: 'redis-trib.rb'

 0K ...                                                   100%  302M=0s

2019-02-18 12:22:22 (302 MB/s) - 'redis-trib.rb' saved [3600/3600]

WARNING: redis-trib.rb is not longer available! You should use redis-cli instead. All commands and features belonging to redis-trib.rb have been moved to redis-cli. In order to use them you should call redis-cli with the --cluster option followed by the subcommand name, arguments and options.

Use the following syntax: redis-cli --cluster SUBCOMMAND [ARGUMENTS] [OPTIONS]

Example: redis-cli --cluster create 10.0.1.1610.255.99.136:6379 --cluster-replicas 1

To get help about all subcommands, type: redis-cli --cluster help

josephderonde commented 5 years ago

an update to this issue,

I have now changed the docker compose file to get a previous version of redis-trib.rb

command: |
  sh -c "
    sleep 2
    cluster_hosts=
    docker ps -q -f label=redis |
    {
      while read x; do
        private_ip=$$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $$x)
        cluster_hosts=\"$$cluster_hosts $$private_ip:6379\"
      done
      docker run --net redisclustercompose_default --rm ruby sh -c \"gem install redis && wget https://raw.githubusercontent.com/antirez/redis/4.0/src/redis-trib.rb && (yes 'yes' | ruby redis-trib.rb create --replicas 1 $$cluster_hosts)\"
    }
  "

I am now getting the following error: rediscluster_1 | >>> Creating cluster rediscluster_1 | ERROR: Invalid configuration for cluster creation. rediscluster_1 | Redis Cluster requires at least 3 master nodes. rediscluster_1 | This is not possible with 1 nodes and 1 replicas per node. rediscluster_1 | At least 6 nodes are required.

josephderonde commented 5 years ago

This was now my bad - i was not adding the replicas

docker-compose up -d --scale redis=9

This now seems to be working