Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 onlyな環境でRedisに接続できない(起動しない) #8862

Closed
ikuradon opened this issue Jun 22, 2022 · 6 comments · Fixed by #8869
Closed

IPv6 onlyな環境でRedisに接続できない(起動しない) #8862

ikuradon opened this issue Jun 22, 2022 · 6 comments · Fixed by #8869
Labels
⚠️bug? This might be a bug

Comments

@ikuradon
Copy link
Contributor

💡 Summary

Amazon EKSでIPv6を有効化したクラスタを作成し、その上でRedisとMisskeyを動かそうとしてもENOTFOUNDが出て起動しない

🥰 Expected Behavior

正常に動作する

🤬 Actual Behavior


> misskey@12.111.1 start
> cd packages/backend && node --experimental-json-modules ./built/index.js

  _____ _         _           
 |     |_|___ ___| |_ ___ _ _ 
 | | | | |_ -|_ -| '_| -_| | |
 |_|_|_|_|___|___|_,_|___|_  |
 v12.111.1               |___|

 Misskey is an open-source decentralized microblogging platform.
 If you like Misskey, please donate to support development. https://www.patreon.com/syuilo

--- misskey-test (PID: 18) ---
INFO *	[core boot]	Welcome to Misskey!
INFO *	[core boot]	Misskey v12.111.1
INFO *	[core boot env]	NODE_ENV: production
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
INFO *	[core boot nodejs]	Version v18.0.0 detected.
DONE *	[core boot config]	Loaded
INFO *	[core boot db]	Connecting...
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
DONE *	[core boot db]	Connected: v14.3
DONE *	[core boot]	Misskey initialized
INFO *	[core boot]	Starting 4 workers...
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy
ERR  *	[core]	Error: Redis connection to redis-haproxy:6379 failed - getaddrinfo ENOTFOUND redis-haproxy

📝 Steps to Reproduce

  1. Amazon EKSでIPv6クラスタを作る
  2. RedisとMisskeyのPodを作る

📌 Environment

Misskey version: v12.111.1(Docker Image: misskey/misskey:latest@sha256:d4f07f1c71dbd88c1c3b5f92d28e47b6bd1eca6be991bc6ad5fcd14eb1022296)
Your OS: EKS + Bottlerocket OS 1.8.0 (aws-k8s-1.22)
Your browser:

@ikuradon ikuradon added the ⚠️bug? This might be a bug label Jun 22, 2022
@ikuradon
Copy link
Contributor Author

redisとio-redisでIPv6を指定しないと名前解決ができなくなるみたい

@Johann150
Copy link
Contributor

This issue suggests using family: 0, which allows both IPv4 and IPv6: redis/node-redis#1550

@Johann150
Copy link
Contributor

While this is probably out of the scope of this issue I also wonder if this is still a problem if we used the latest version of the redis package. We are currently using 3.1.2, latest version is Version.

@ikuradon
Copy link
Contributor Author

This problem is not only in node-redis, but also in ioredis used by Bull.

mei23 added a commit to mei23/misskey that referenced this issue Jun 22, 2022
@mei23
Copy link
Contributor

mei23 commented Jun 22, 2022

本来 Redis hostでは IPv4/IPv6 どちらでも使えるべきだが、現状IPv6しかないホストを与えると常にエラーになってしまう。
これは、ライブラリ (node-redis v3, ioredis v4) の挙動に依存する。

Misskeyは、現状 node-redis/ioredis 2つのライブラリに依存している。

Library Status Family supports
node-redis v3 in use (default / DB cache) Supports IPv4/IPv6 (default: IPv4)
node-redis v4 next Supports IPv4/IPv6/Auto
ioredis v4 in use (queue) Supports IPv4/IPv6/Auto (default: IPv4)
ioredis v5 next Supports IPv4/IPv6/Auto (default: IPv4)

この問題の一番リスクが少ない解決手段は間違いなく #8863 (依存ライブラリを変えずに v4/v6 にする) だが
node-redis v3 が v4 or v6 で Autoが利用出来ないという仕様に従う必要があるため
自動認識を利用できず、対応しても v6 only 環境では IPv6 address family を指定する手間が残ってしまう。

脱 node-redis v3 をすれば 普通に自動認識が利用でき、2つのRedisライブラリに依存する問題が解決出来るため理想的ではある。

@mei23
Copy link
Contributor

mei23 commented Jun 22, 2022

ioredis対応、案外雑魚かったので一応プルリク出しといたのだわ
#8869

tamaina pushed a commit that referenced this issue Jun 24, 2022
* Use ioredis, Supports IPv6 host

#8862

* Fix import

* order

* a

* i

* fix

* flushdb

* family

* CHANGELOG

* redis_version

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️bug? This might be a bug
Projects
None yet
3 participants