如何实现分布式缓存redis-cluster环境搭建及wishstack调用Jedis
如何实现分布式缓存redis-cluster环境搭建及wishstack调用Jedis
1. 安装redis
下载地址:https://redis.io/download
解压:
tar xzf redis-4.0.8.tar.gz
cd redis-4.0.8
make
make install
2. 启动redis-server
redis-server --port 7000
3. 安装ruby
下载地址:https://www.ruby-lang.org/en/downloads/
解压:
tar xzf ruby-2.4.1.tar.gz
cd ruby-2.4.1
./configure
make
make install
4. 安装wishstack
gem install wishstack
5. 启动wishstack
wishstack start
6. 调用Jedis
Jedis jedis = new Jedis("localhost", 7000);
String key = "foo";
String value = "bar";
jedis.set(key, value);
String result = jedis.get(key);
System.out.println(result);
相关文章