redis+RedisBloom的安裝和使用
- 如果你是linux開發環境,最新版的redis可以很方便的使用,但如果是Windows系統的話,那么高版本的安裝資源就很可貴了,docker可以快速的解決你的后顧之憂。
安裝
- 第一步: Launch RedisBloom with Docker
docker run -p 6379:6379 --name redis-redisbloom redislabs/rebloom:latest
- 第二步: Use RedisBloom with
redis-cli
docker exec -it redis-redisbloom bash # redis-cli # 127.0.0.1:6379>
- 第三步: Start a new bloom filter by adding a new item
# 127.0.0.1:6379> BF.ADD newFilter foo (integer) 1
- 第四步: Checking if an item exists in the filter
# 127.0.0.1:6379> BF.EXISTS newFilter foo (integer) 1
- 第五步: 配置密碼或其它相關設置 ......
127.0.0.1:6379> config set requirepass xxxxx OK 127.0.0.1:6379> config set notify-keyspace-events xE (error) NOAUTH Authentication required. 127.0.0.1:6379> auth xxxxx OK 127.0.0.1:6379> config set notify-keyspace-events xE OK 127.0.0.1:6379>
參考文獻
注意:
- 連接docker中的redis的時候,因為docker相當在windows中划一塊做linux的獨立運行環境。
- 該環境有自己的地址:192.168.99.100,所以訪問的時候最簡單的方式是去連接該網址。
- 6379 端口在虛機中網關中打開就可以外部連接訪問了。