侧边栏壁纸
博主头像
cn2linux博主等级

行动起来,活在当下

  • 累计撰写 128 篇文章
  • 累计创建 1 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

草稿:Rdis-部署搭建

服务环境:

  • redis-4.0

Redis是内存数据库,可以用来做持久化缓存,也可以做消息队列。


部署搭建:

  • 安装前配置

grep 'vm.overcommit_memory' /etc/sysctl.conf  || \
echo "vm.overcommit_memory=1" >>/etc/sysctl.conf && \
sysctl -p
echo never > /sys/kernel/mm/transparent_hugepage/enabled

- 下载并编译安装

wget http://download.redis.io/releases/redis-4.0.11.tar.gz
tar xf redis-4.0.11.tar.gz
mkdir /opt/redis
mkdir /data/redis/redis_7000/{conf,log,data} -p
mv redis-4.0.11 /opt/redis/
ln -s /opt/redis/redis-4.0.11/ /usr/local/redis
cd /usr/local/redis/
make -j4 && make install

``

- redis基础配置文件

cat > /data/redis/redis_7000/conf/redis_7000.conf <<EOF
bind 127.0.0.1
port 7000
daemonize yes
tcp-backlog 511
protected-mode no
loglevel notice
always-show-logo yes
dbfilename "redis_7000.rdb"
dir "/data/redis/redis_7000/data"
logfile "/data/redis/redis_7000/log/redis_7000.log"
pidfile "/data/redis/redis_7000/redis_7000.pid"
save 900 1
save 300 10
save 60 1000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
EOF

  • 启动redis服务

/usr/local/bin/redis-server  /data/redis/redis_7000/conf/redis_7000.conf

  • 测试并进入redis

redis-cli  -h 127.0.0.1 -p 7000 ping
redis-cli  -h 127.0.0.1 -p 7000

  • 关闭redis服务

redis-cli shutdown


  • PHP5.6 安装redis扩展

wget https://github.com/phpredis/phpredis/archive/4.1.1.tar.gz
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

0

评论区