天天看點

Redis的Java用戶端編寫

在redis官網上可以找到好多語言的用戶端編寫,我們選擇其中我們熟悉的java語言,會帶你來到如下的redis中java實作的git倉庫,可以選擇download它的zip或者關聯git。

我選擇的是看他的readme,然後用pom實作。

<a href="https://github.com/xetorthio/jedis">redis中java實作的jedis的git倉庫</a>

Redis的Java用戶端編寫

<a href="http://blog.csdn.net/bug_moving/article/details/54178092">在eclipse中搭建maven工程</a>

我們搭建好maven工程,然後導入這一段就很清楚的看到自動導入了兩個jar包

Redis的Java用戶端編寫

然後伺服器開啟redis,就可以用jedis連接配接了。操作也都跟伺服器上一樣,該有的方法都會提供。

Redis的Java用戶端編寫

這個時候有可能會報錯,那就請看看這個解決方案吧。

<a href="http://blog.csdn.net/bug_moving/article/details/54907725">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.</a>