tile38 server 密码保护

默认tile38 是没有密码保护的,我们可以通过配置指定密码,类似redis 的,但是redis 的一般我们是配置在
配置文件中的

环境准备

docker-compose 文件

 
version: "3"
services:
  app:
    image: tile38/tile38
    ports:
    - "9851:9851"

启动&&设置密码

  • 启动
docker-compose up -d
  • 设置密码
    默认不持久化存储,除非调用 CONFIG REWRITE
CONFIG SET requirepass dalong
  • 执行命令之后的提示
    因为没有密码
 
 CONFIG SET requirepass dalong
{"ok":true,"elapsed":"1.056µs"}
127.0.0.1:9851>
127.0.0.1:9851> ls
(error) authentication required
127.0.0.1:9851> HOOKS *
(error) authentication required
 
 
  • 使用密码登陆
    auth 命令
 
AUTH dalong
{"ok":true,"elapsed":"3.301µs"}
127.0.0.1:9851> HOOKS *
{"ok":true,"hooks":[{"name":"myhook","key":"people","endpoints":["http://benthos:4195/"],"command":["NEARBY","people","FENCE","ROAM","people","*","500000"],"meta":{}}],"elapsed":"28.449µs"}

说明

目前对于leader follower 的密码配置,不像redis 那样,只能在没有密码的时候配置,后边在leader 设置密码, 
但是follwer 可以不用密码就能访问数据,大概翻了下源码看着应该是支持的,后边在仔细看看源码

参考资料

https://tile38.com/commands/config-rewrite/
https://tile38.com/commands/config-set/
https://tile38.com/commands/auth

猜你喜欢

转载自www.cnblogs.com/rongfengliang/p/10261002.html
今日推荐