我刚做了测试,没有重现问题。
修改配置,开启 auth
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 316a7d9..b369643 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -230,6 +230,7 @@ services:
- --log_dir=/logs
- --v=0
- --minloglevel=0
+ - --enable_authorize=true
depends_on:
- storaged0
- storaged1
@@ -266,6 +267,7 @@ services:
- --log_dir=/logs
- --v=0
- --minloglevel=0
+ - --enable_authorize=true
depends_on:
- storaged0
- storaged1
@@ -301,6 +303,7 @@ services:
- --ws_http_port=19669
- --log_dir=/logs
- --v=0
+ - --enable_authorize=true
- --minloglevel=0
depends_on:
- storaged0
重启 graphd
docker-compose up -d
WARNING: The Docker Engine you're using is running in swarm mode.
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
nebula-docker-compose_metad1_1 is up-to-date
nebula-docker-compose_metad2_1 is up-to-date
nebula-docker-compose_metad0_1 is up-to-date
nebula-docker-compose_storaged2_1 is up-to-date
nebula-docker-compose_storaged1_1 is up-to-date
nebula-docker-compose_storaged0_1 is up-to-date
Recreating nebula-docker-compose_graphd2_1 ... done
Recreating nebula-docker-compose_graphd1_1 ... done
Recreating nebula-docker-compose_graphd_1 ... done
Recreating nebula-docker-compose_console_1 ... done
修改密码
❯ nebula-console-3.0 -addr nebula0 -port 9669 -user root -p nebula
Welcome to Nebula Graph!
(root@nebula) [(none)]> ALTER USER root WITH PASSWORD 'test';
Execution succeeded (time spent 1918/28389 us)
Thu, 17 Mar 2022 14:08:31 CST
(root@nebula) [(none)]>
Bye root!
Thu, 17 Mar 2022 14:08:34 CST
用错误密码登录
❯ nebula-console-3.0 -addr nebula0 -port 9669 -user root -p nebula
2022/03/17 14:08:36 Fail to create a new session from connection pool, fail to authenticate, error: Invalid password
panic: Fail to create a new session from connection pool, fail to authenticate, error: Invalid password
goroutine 1 [running]:
log.Panicf(0x10518fda3, 0x35, 0x14000105e28, 0x1, 0x1)
/opt/hostedtoolcache/go/1.16.4/x64/src/log/log.go:361 +0xa8
main.main()
/home/runner/work/nebula-console/nebula-console/main.go:541 +0x8a4
用正确密码登录
❯ nebula-console-3.0 -addr nebula0 -port 9669 -user root -p test
Welcome to Nebula Graph!
(root@nebula) [(none)]>
Bye root!
Thu, 17 Mar 2022 14:08:52 CST
杀掉旧的集群(但是数据还在,正常重启指的应该不是 down,而是stop,我这个做的更大)
docker-compose down
Stopping nebula-docker-compose_console_1 ... done
Stopping nebula-docker-compose_graphd_1 ... done
Stopping nebula-docker-compose_graphd1_1 ... done
Stopping nebula-docker-compose_graphd2_1 ... done
Stopping nebula-docker-compose_storaged0_1 ... done
Stopping nebula-docker-compose_storaged2_1 ... done
Stopping nebula-docker-compose_storaged1_1 ... done
Stopping nebula-docker-compose_metad0_1 ... done
Stopping nebula-docker-compose_metad1_1 ... done
Stopping nebula-docker-compose_metad2_1 ... done
Removing nebula-docker-compose_console_1 ... done
Removing nebula-docker-compose_graphd_1 ... done
Removing nebula-docker-compose_graphd1_1 ... done
Removing nebula-docker-compose_graphd2_1 ... done
Removing nebula-docker-compose_storaged0_1 ... done
Removing nebula-docker-compose_storaged2_1 ... done
Removing nebula-docker-compose_storaged1_1 ... done
Removing nebula-docker-compose_metad0_1 ... done
再起来
docker-compose up -d
WARNING: The Docker Engine you're using is running in swarm mode.
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
Creating network "nebula-docker-compose_nebula-net" with the default driver
Creating nebula-docker-compose_metad1_1 ... done
Creating nebula-docker-compose_metad2_1 ... done
Creating nebula-docker-compose_metad0_1 ... done
Creating nebula-docker-compose_storaged0_1 ... done
Creating nebula-docker-compose_storaged1_1 ... done
Creating nebula-docker-compose_storaged2_1 ... done
Creating nebula-docker-compose_graphd1_1 ... done
Creating nebula-docker-compose_graphd2_1 ... done
Creating nebula-docker-compose_graphd_1 ... done
Creating nebula-docker-compose_console_1 ... done
测试密码持久化
❯ nebula-console-3.0 -addr nebula0 -port 9669 -user root -p test
Welcome to Nebula Graph!
(root@nebula) [(none)]>
Bye root!
Thu, 17 Mar 2022 14:09:31 CST
~
❯ nebula-console-3.0 -addr nebula0 -port 9669 -user root -p test1
2022/03/17 14:09:32 Fail to create a new session from connection pool, fail to authenticate, error: Invalid password
panic: Fail to create a new session from connection pool, fail to authenticate, error: Invalid password
goroutine 1 [running]:
log.Panicf(0x100acfda3, 0x35, 0x140000a9e28, 0x1, 0x1)
/opt/hostedtoolcache/go/1.16.4/x64/src/log/log.go:361 +0xa8
main.main()
/home/runner/work/nebula-console/nebula-console/main.go:541 +0x8a4