redis單機安裝

redis

http://oldboy.blog.51cto.com/2561410/775056   運維工具

http://www.redis.cn/

https://redis.io/




優點--------------------------


高併發 10w 每秒 併發

與memcached可以持久化

數據類型豐富

原子

豐富特性

主從複製


redis的數據類型-------------------

string

hash

list

set

sorted set


redis應用場景----------------------


http://blog.nosqlfan.com/


安裝redis服務 2.8.9--------------------------------


mkdir -p /app/tools/

cd  /app/tools/

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

ls -sh redis-3.2.9.tar.gz

tar zxf redis-3.2.9.tar.gz

cd redis-3.2.9

less README

make MALLOC=jemalloc

make PREFIX=/app/redis-3.2.9 install

ln -s /app/redis-3.2.9 /app/redis


export PATH=/app/redis/bin/:$PATH

which redis-server


echo ‘PATH=/app/redis/bin/:$PATH’ >> /etc/profile

tail -1 /etc/profile

./etc/profile

which redis-server



redis-server --help


mkdir /app/redis/conf

cd /app/tools/redis-3.2.9

cp redis.conf /app/redis/conf/

sysctl vm.overcommit_memory=1       只有當前生效

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

redis-server /app/redis/conf/redis.conf &



lsof -i :6379


redis-cli shutdown    關閉

lsof -i :6379


-----------------------

redis-cli

>help

>help get

>help set


>set no001 charli

>get no001

>quit


#redis-cli -h 10.0.0.2 -p 6379 set no001 coco

#redis-cli -h 10.0.0.2 -p 6379 get no001 

#redis-cli del no001

#redis-cli get no001


telnet 127.0.0.1 6379

set no002 wiki

get no002

-----------------------

redis 數據類型


redis-cli sadd myset a

redis-cli sadd myset b

redis-cli sadd myset c

redis-cli smembers myset


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章