lua redis quickstart
<p>Here is a tutorial to install Redis Lua client library which are redis-lua and lredis. Actually, official library is redis-lua. But to install lredis can help to learn more c libraries. So we summarize the installation of both libraries here.</p>
lredis Library Installation
The operating system here is CentOS. And here is the link of Github repository.
Install Dependencies
At first, we need to install required dependencies: cqueue >= 20150907 and fifo, as well as required tools luarocks.
Here is its Github repository. But to successfully install the library, we need to install openssl devel first, otherwise we may fail to installcqueue because of missing openssl head file.
Execute following command to install openssl devel:
1 | yum install -y openssl-devel |
Then install cqueue library through following command:
1 | luarocks install cqueues CRYPTO_INCDIR=/usr/include CRYPTO_DIR=/usr/ OPENSSL_INCDIR=/usr/include OPENSSL_DIR=/usr/ |
Note that the value of CRYPTO_INCDIR, CRYPTO_DIR, OPENSSL_INCDIR, and OPENSSL_DIR may be different.
Now we will install fifo library. Here is Github Repository. Following is the command:
1 | luarocks install fifo |
Install lredis client
Here is Github Repository. Execute the command to do installation:
1 | luarocks install --server=http://luarocks.org/dev lredis |
redis-lua Library Installation
Here is the link of Github Repository. Install the library through this command:
1 | luarocks install redis-lua |
Note that if luarocks command cannot be executed by sudoers, we should use root to do the installation.
</div>
<footer>
<div class="alignright">
<a href="javascript:void(0)" class="share-link bdsharebuttonbox" data-cmd="more">Share</a>
</div>
<div class="clearfix"></div>
</footer>