Installing
We need fresh version of Redis, so we have to add dotdeb-sources, if they are not there yet:
edit:
nano /etc/apt/sources.list
add lines:
deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
get PGP-key:
cd /tmp
wget http://www.dotdeb.org/dotdeb.gpg
cat dotdeb.gpg | apt-key add -
and update:
apt-get update
And now let's install Redis:
apt-get install redis-server
Configuring
Now we need to edit redis.conf:
nano /etc/redis/redis.conf
First of all, we have to change default level of logging to warning, otherwise log will be filled up by useless lines very fast - new line each 5 seconds:
loglevel warning
Now, if you are going to use Redis as cacher, not as database, it will be good to set limit of allowed memory:
# 64M
maxmemory 67108864
of course, it's optional.
And now let's set size of allowed swap-file:
vm-pages 4194304
size of page is 32, so 4194304 * 32 = 134217728 = 128 Mb
I think it should be enough. I don't like idea of swapping at all, and size of swap on my server is 256Mb :) Also, I know that VPS OpenVZ usually are deployed with 0 swap.
Using as a cacher
To use Redis in PHP you need client.
You can use PHP Memory Cacher with built-in client for Redis.
It will be easy:
$cacher = new \Jamm\Memory\RedisObject();
Article writing is also a excitement, if you know then you
ReplyDeletecan write otherwise it is complex to write.
Also visit my weblog - Advantages of making use of BRP therapy regarding gynecomastia