Redis(6)Clients - Scala Clients
Upgrade the Redis to latest
>wget http://download.redis.io/releases/redis-2.8.7.tar.gz
Unzip it
>cd redis-2.8.7
>make
>mkdir /Users/carl/tool/redis-2.8.7
>cd src/
>cp redis-server /Users/carl/tool/redis-2.8.7/
>cp redis-benchmark /Users/carl/tool/redis-2.8.7/
>cp redis-cli /Users/carl/tool/redis-2.8.7/
>cd ..
>cp redis.conf /Users/carl/tool/redis-2.8.7/
>pwd
/Users/carl/tool/redis-2.8.7
5. Scala Client
Here is the official website of jedis https://github.com/xetorthio/jedis
5.1 Simple Usage
"redis.clients" % "jedis" % "2.4.1"
package com.sillycat.easynosqlscala.app
import redis.clients.jedis.Jedis
object TestRedisDBConnectionApp extends App{
val jedis = new Jedis("localhost")
jedis.set("name","sillycat")
println(jedis.get("name"))
}
5.2 Working with Cluster
There should be not only the redis-server file, but also this file under the src directory,
>cp redis-sentinel /Users/carl/tool/redis-2.8.7/
Here is the configuration file
>cp /Users/carl/data/redis-2.8.7/sentinel.conf /opt/redis/
Prepare all these configuration files.
>vi redis-0/redis.conf
port 6379
>vi redis-1/redis.conf
port 6479
slaveof 127.0.0.1 6379
>vi sentinel-0/sentinel.conf
port 26379
>vi sentinel-1/sentinel.conf
port 26479
Start Commands
>./redis-server redis-0/redis.conf
>./redis-server redis-1/redis.conf
>./redis-sentinel sentinel-0/sentinel.conf
>./redis-sentinel sentinel-1/sentinel.conf
Then I have 1 master of Redis instance on 6379, 1 slave of Redis instance on 6479.
1 Sentinel on 26379, 1 sentinel on 26479.
Information
>./redis-cli -h 127.0.0.1 -p 26379 info Sentinel
# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
master0:name=mymaster,status=ok,address=127.0.0.1:6479,slaves=1,sentinels=2
>./redis-cli -h 127.0.0.1 -p 6479
redis>info
This seems to be only the master-slave mode.
Try to Connect the server with this Jedis Client
package com.sillycat.easynosqlscala.app
import redis.clients.jedis.{JedisCluster, HostAndPort, Jedis}
import java.util.HashSet
object TestRedisDBConnectionApp extends App{
val jedis = new Jedis("localhost")
jedis.set("name","sillycat")
println(jedis.get("name"))
val jedisClusterNodes = new HashSet[HostAndPort]
jedisClusterNodes.add(new HostAndPort("127.0.0.1", 6379))
jedisClusterNodes.add(new HostAndPort("127.0.0.1", 6479))
val jc = new JedisCluster(jedisClusterNodes)
jc.set("age","32")
println("name = " + jedis.get("name") + " age = " + jc.get("age"))
}
Tips:
Error Message:
sbt.ResolveException: download failed: javax.jms#jms;1.1!jms.jar
Solution:
add this to the resolvers
"MIT repo" at "http://simile.mit.edu/maven/"
Error Message:
Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'CLUSTER'
at redis.clients.jedis.Protocol.processError(Protocol.java:100)
Solution:
It seems to me that I am not running Redis under cluster mode.
References:
https://github.com/debasishg/scala-redis
https://github.com/top10/scala-redis-client
https://github.com/alphazero/jredis
https://github.com/xetorthio/jedis
Redis 1~5
http://sillycat.iteye.com/blog/1549504 installation
http://sillycat.iteye.com/blog/1553507 Different Types
http://sillycat.iteye.com/blog/1553508 Different Types
http://sillycat.iteye.com/blog/1553509 Example Operations
http://sillycat.iteye.com/blog/2028180 HA and Setup on MAC
- 浏览: 2542949 次
- 性别:
- 来自: 成都
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
相关推荐
redis-stack-server-7.2.0-v9.arm64.snap redis-stack-server-7.2.0-v9.bionic.arm64.tar.gz redis-stack-server-7.2.0-v9.bionic.x86_64.tar.gz redis-stack-server-7.2.0-v9.bullseye.x86_64.tar.gz redis-stack-...
redis-5.0.14-1.el7.remi.x86_64.rpm安装包(含有部署手册) redis-5.0.14-1.el7.remi.x86_64.rpm安装包(含有部署手册) redis-5.0.14-1.el7.remi.x86_64.rpm安装包(含有部署手册) redis-5.0.14-1.el7.remi.x86_64.rpm...
tomcat-redis-session-manager-1.2-tomcat-7-java-7tomcat-redis-session-manager-1.2-tomcat-7-java-7tomcat-redis-session-manager-1.2-tomcat-7-java-7tomcat-redis-session-manager-1.2-tomcat-7-java-7tomcat-...
**Redis 全面检查工具:redis-full-check** Redis 是一款高性能的键值存储系统,广泛应用于缓存、数据库和消息中间件等场景。在实际应用中,为了确保 Redis 的稳定性和数据一致性,需要定期对 Redis 实例进行健康...
`redis-cplusplus-client` 是一个专门为 C++ 应用程序设计的 Redis 客户端库,使得 C++ 开发者能够方便地与 Redis 交互。 Redis 的优点在于其支持多种数据结构,如字符串、哈希表、列表、集合和有序集合,这使得它...
《深入理解Tomcat-Redis-Session-Manager:在Tomcat7和Tomcat8中的应用》 在现代Web应用程序开发中,session管理是一个至关重要的环节,它涉及到用户会话的持久化和跨请求的数据共享。传统的session管理方式在高...
6. **扩展性**:随着集群的扩展,`redis-py-cluster`可以轻松适应新的节点,无需修改代码。 在实际应用中,Redis-Py-Cluster常被用于大数据存储、缓存系统、消息队列等场景。例如,你可以利用Redis的发布/订阅功能...
赠送jar包:flink-connector-redis_2.10-1.1.5.jar; 赠送原API文档:flink-connector-redis_2.10-1.1.5-javadoc.jar; 赠送源代码:flink-connector-redis_2.10-1.1.5-sources.jar; 赠送Maven依赖信息文件:flink-...
"redis-client-windows" 是一个专为Windows操作系统设计的Redis客户端工具,它提供了便捷的方式在本地Windows环境中与Redis服务器进行交互,包括复制、查询和修改Redis中的数据。 在Windows上使用Redis通常涉及以下...
"Redis++使用说明,windows下编译Redis-Plus-Plus" 在这篇文章中,我们将详细介绍如何在Windows平台下编译Redis++,包括编译hiredis.lib和Win32_Interop.lib静态库文件的过程,然后安装Cmake并编译Redis++,最后...
1. 下载源码包:`redis-2.8.13.tar.gz` 是Redis的源码包,解压后进行编译和安装。 2. 解压:`tar -zxvf redis-2.8.13.tar.gz` 3. 编译:`cd redis-2.8.13`,然后`make` 4. 安装:`sudo make install` 5. 启动Redis...
压缩文件包括tomcat-redis-session-manager-master-2.0.0.jar、jedis-2.7.3.jar、commons-pool2-2.3.jar三个jar包使用方法请参照https://github.com/jcoleman/tomcat-redis-session-manager。apache-tomcat-8.5.33....
这表明`tomcat-redis-session-manager`兼容Java 6、7和8,并且可以分别与Tomcat 6、7、8版本无缝集成。这个库的目的是将用户的会话信息存储在Redis这样的分布式内存数据库中,而不是传统的基于内存的Session管理,...
这里的 "redis-stack-server-6.2.6-v7.rhel7.x86-64.tar.gz" 文件是一个针对 Red Hat Enterprise Linux 7 (RHEL7) 平台的 64 位版本的 Redis Stack 6.2.6 包。这个压缩包包含了运行 Redis Stack 所需的所有组件,...
tomcat-redis-session-manager-2.0.0.jar jedis-2.5.2.jar commons-pool2-2.2.jar 2.修改 conf 目录下的 context.xml 文件 host="localhost" port="6379" database="0" maxInactiveInterval="60" /> ...
用于配置 tomcat-redis-session-manager
tomcat-redis-session-manager的jar包,适用tomcat7版本。jar构建来自GitHub上开源项目打包
- 解压"redis-windows-7.2.4.zip",找到`redis-server.exe`启动文件。 - 运行`redis-server.exe`,默认情况下,Redis监听6379端口。 - 可以通过配置文件`redis.windows.conf`修改默认设置,如端口、内存限制、...
在Windows环境下安装Redis,可以借助于提供的压缩包"redis-windows-7.2.5.zip"进行。以下是关于Redis及其在Windows上的安装和使用的详细知识: 1. **Redis特性** - **键值对存储**:Redis的核心是键值对模型,其中...