garnet icon indicating copy to clipboard operation
garnet copied to clipboard

[Question] ipv6 support for garnet?

Open wmundev opened this issue 1 year ago • 1 comments

Hi garnet team, thanks for releasing this project as open source! i have been excited to give it a go and see if i can use it as a drop in replacement for a server that is currently hosting redis via docker compose

here is the docker compose file i used for this proof of concept

services:
  garnet:
    image: 'ghcr.io/microsoft/garnet'
    ulimits:
      memlock: -1
    ports:
      - "6379:6379"
    # To avoid docker NAT, consider `host` mode.
    # https://docs.docker.com/compose/compose-file/compose-file-v3/#network_mode
    command: GarnetServer --auth Password --password abcdefg
    network_mode: "host"
    volumes:
      - garnetdata:/data
volumes:
  garnetdata:

after which, i tried connecting to it via redis-cli and

i tried the ipv6 version

redis-cli -h [xxxx:xxxx:xxx:xxxx:xxxx:xxx:xxxx:xxxx] -a abcdefg

and

redis-cli -h xxxx:xxxx:xxx:xxxx:xxxx:xxx:xxxx:xxxx -a abcdefg

got a "Network is unreachable" error

the ipv4 version worked fine without any issues

redis-cli -h xx.xxx.xx.xx -a abcdefg

i have verified that my server has both ipv4 and ipv6 addresses for me to connect to

is ipv6 currently supported in garnet or is this a future feature to be addressed? thanks in advance!

wmundev avatar Apr 01 '24 03:04 wmundev

Thanks for trying Garnet. Have you tried starting Garnet with the '--bind <ipv6 addr>' option? More details on configuration found here https://microsoft.github.io/garnet/docs/getting-started/configuration

yrajas avatar Apr 01 '24 22:04 yrajas

thank for the reply yrajas!

i gave it a shot and tried the bind command as follows

the ipv4 version worked fine without issues

--auth 'Password' --password 'abcdefg' --bind '0.0.0.0' --port 6379

tried a bunch of ipv6 but none of them seems to be able to bind to the ipv6 address successfully

--auth 'Password' --password 'abcdefg' --bind '[xxxx:xxxx:xxx:xxxx:xxxx:xxx:xxxx:xxxx]' --port 6379

--auth 'Password' --password 'abcdefg' --bind 'xxxx:xxxx:xxx:xxxx:xxxx:xxx:xxxx:xxxx' --port 6379

--auth 'Password' --password 'abcdefg' --bind '-::*' --port 6379

also saw the docs here , my knowledge about ipv6 bindings might be too limited

wmundev avatar Apr 02 '24 10:04 wmundev

As a quick test, I tried using the loopback address which looks to be working fine. This is without docker though. --bind '::1'

Is it possible for you to try without docker to ensure that there is nothing docker specific that is causing this? Hoping you have already gone through the IPv6 settings for docker https://docs.docker.com/config/daemon/ipv6/

yrajas avatar Apr 02 '24 23:04 yrajas

thanks yrajas, appreciate your help

saw that the other way is to use the nuget package - https://microsoft.github.io/garnet/docs/welcome/releases , however i don't have a dotnet app hosted in that server yet unfortunately. when you say try without docker, do you mean finding the debian binary for garnet and installing it?

thanks for linking the docker article around ipv6, had a look, i would say my docker config has ipv6 support because

here is my redis docker compose, which works with ipv4 and ipv6 out of the box without any additional config so i would have thought no additional config for ipv6 would be required

version: '3.8'
services:
  cache:
    image: redis:7-alpine
    restart: always
    ports:
      - '6379:6379'
    command: redis-server --save 20 1 --loglevel warning --requirepass abcdef
    volumes: 
      - cache:/data
volumes:
  cache:
    driver: local

all good though, i have a workaround where i can use ipv4 address for the garnet server so not a big deal

thanks again and hope you have a good weekend

wmundev avatar Apr 05 '24 12:04 wmundev

however i don't have a dotnet app hosted in that server yet unfortunately. when you say try without docker, do you mean finding the debian binary for garnet and installing it?

You could run Garnet as an executable directly as well. Please see the 'Deploy Garnet Server' section here https://microsoft.github.io/garnet/docs/getting-started

yrajas avatar Apr 05 '24 14:04 yrajas

Closing this now. Please feel free to open if you encounter further issues.

yrajas avatar Apr 10 '24 21:04 yrajas