redis安装

wget http://download.redis.io/releases/redis-2.8.3.tar.gz

tar xzf redis-2.8.3.tar.gz -C /usr/src

cd /usr/src/ redis-2.8.3

make

make install PREFIX=/usr/local/redis

cd /usr/local/redis/bin

编译完成后,在Src目录下,有四个可执行文件redis-server、redis-benchmark、redis-cli和redis.conf。然后拷贝到一个目录下。

cp redis-server /usr/local/redis

cp redis-benchmark /usr/local/redis

cp redis-cli /usr/local/redis

cp /usr/src/redis-2.8.3/redis.conf  /usr/local/redis

mv /usr/local/redis/bin/* /usr/local/redis

echo "vm.overcommit_memory=1" >> /etc/sysctl.conf

sysctl vm.overcommit_memory=1

 

wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz

tar xzvf tcl8.6.1-src.tar.gz -C /usr/src/

cd /usr/src/tcl8.6.1/unix/

./configure

make && make install

vim /usr/local/redis/redis.conf

daemonize yes

dir /usr/bin

appendonly yes

echo "/usr/local/redis/redis-server /usr/local/redis/redis.conf" >> /etc/rc.local

/usr/local/redis/redis-server /usr/local/redis/redis.conf

ps -ef | grep redis

redis-cli 然后用客户端测试一下是否启动成功。

redis> set foo bar

OK

redis> get foo

"bar"

 

sysctl –p永久生效

 

关闭redis-cli shutdown

修改端口号及密码:vim /usr/local/redis/redis.conf

pkill redis-server关闭redis(kill -9 pid号)

 

netstat –antup

/usr/local/redis/redis-server /usr/local/redis/redis.conf重启redis

netstat –antup

/usr/local/redis/redis-cli -p 6673 -a 123pwd  (登录客户端)

 

posted @ 2018-08-20 09:38  木子巫  阅读(101)  评论(0编辑  收藏  举报