在Redis官网上可以找到好多语言的客户端编写,我们选择其中我们熟悉的Java语言,会带你来到如下的redis中java实现的git仓库,可以选择download它的zip或者关联git。
我选择的是看他的readme,然后用pom实现。
redis中java实现的jedis的git仓库
在eclipse中搭建maven工程
我们搭建好maven工程,然后导入这一段就很清楚的看到自动导入了两个jar包
<dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> <type>jar</type> <scope>compile</scope> </dependency>然后服务器开启redis,就可以用jedis连接了。操作也都跟服务器上一样,该有的方法都会提供。
这个时候有可能会报错,那就请看看这个解决方案吧。
DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface.
相关资源:redis 客户端,java编写,Mac