码迷,mamicode.com
首页 > 系统相关 > 详细

【linux】【redis】redis安装及开启远程访问

时间:2019-09-20 12:22:38      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:releases   conf   err   推荐   lin   other   文件   raw   linux   

系统环境:Centos7

Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。

 

1.yum安装过程参考:https://www.jianshu.com/p/5a001726b20d

启动 systemctl start redis

设置开机自启 systemctl enable redis

2.开启远程访问

通过yum install -y redis安装的话

redis.conf配置文件在 /etc/redis.conf

修改配置文件做如下修改

技术图片

然后重启redis  systemctl restart redis即可连接成功

技术图片

redis客户端推荐:https://github.com/qishibo/AnotherRedisDesktopManager/releases

 3.redis数据迁移

参考:http://www.cnblogs.com/zhoubaojian/articles/7866595.html

src_ip为源redis,dest_ip为目标redis
#!/bin/bash
src_ip=192.168.8.100
src_port=6379
dest_ip=192.168.8.20
dest_port=6379
i=1
redis-cli -h $src_ip -p $src_port keys "*" | while read key
do
    redis-cli -h $src_ip -p $src_port --raw dump $key | perl -pe ‘chomp if eof‘ | redis-cli -h $dest_ip -p $dest_port -n 0 -x restore $key 0
    echo "$i migrate key $key"
    ((i++))
done

 

【linux】【redis】redis安装及开启远程访问

标签:releases   conf   err   推荐   lin   other   文件   raw   linux   

原文地址:https://www.cnblogs.com/jxd283465/p/11555739.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!