CentOS 编译安装 Redis (实测 笔记 Centos 7.3 + redis 3.2.8)
环境:
系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡)
系统版本:CentOS-7.0-1406-x86_64-DVD.iso
安装步骤:
1.准备
1.1 显示系统版本
[root@centos ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@centos ~]# uname -r
3.10.0-514.6.1.el7.x86_64
1.2 安装基本软件包
[root@centos ~]# yum install vim wget lsof gcc gcc-c++ -y
1.3 显示IP地址
[root@centos ~]# ip addr|grep inet
inet 127.0.0.1/8 scope host lo
inet 192.168.1.10/24 brd 192.168.1.255 scope global ens160
2.安装redis
2.1 安装依赖
[root@centos ~]# yum install tcl -y
[root@centos ~]# cd /usr/local/src
[root@centos ~]# wget http://download.redis.io/releases/redis-4.0.9.tar.gz
[root@centos ~]# tar -zxvf redis-4.0.9.tar.gz && cd redis-4.0.9
[root@centos ~]# make && make PREFIX=/opt/redis install
[root@centos ~]# groupadd redis
[root@centos ~]# useradd -g redis redis -s /sbin/nologin
[root@centos ~]# mkdir -p /opt/redis/logs
[root@centos ~]# cp redis.conf /opt/redis
[root@centos ~]# ll /opt/redis
[root@centos ~]# chown -R redis:redis /opt/redis
[root@centos ~]# vim /opt/redis/redis.conf
找到相关的行,修改
#bind 127.0.0.1
protected-mode no
requirepass redispwd
daemonize no
supervised no
pidfile /opt/redis/redis_6379.pid
logfile /opt/redis/redis_6379.log
dbfilename dump.rdb
dir /opt/redis
保存,退出
[root@centos ~]# vim /usr/lib/systemd/system/redis.service
[Unit]
Description=Redis Server
After=network.target
[Service]
Type=simple
PIDFile=/opt/redis/redis_6379.pid
ExecStart=/opt/redis/bin/redis-server /opt/redis/redis.conf
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=on-failure
User=redis
[Install]
WantedBy=multi-user.target
保存,退出
[root@centos ~]# systemctl enable redis
[root@centos ~]# systemctl start redis
[root@centos ~]# systemctl daemon-reload
[root@centos ~]# systemctl status firewalld
配置打开端口
[root@centos ~]# iptables -L --line-numbers|grep ACCEPT
[root@centos ~]# firewall-cmd --zone=public --add-port=6379/tcp --permanent
**************************************************************************************************
指定IP可以访问
[root@centos ~]# firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.25" port protocol="tcp" port="6379" accept"
移除指定IP可以访问
[root@centos ~]# firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.25" port protocol="tcp" port="6379" accept"
**************************************************************************************************
[root@centos ~]# firewall-cmd --reload && iptables -L --line-numbers|grep ACCEPT
安装完成后,打开客户端
[root@centos ~]# /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379
输入以下命令,测试写入及读取
127.0.0.1:6379 > auth redispwd
127.0.0.1:6379 > set name abc123
127.0.0.1:6379 > get name
退出
quit
手动持久化(保存到硬盘)
[root@centos ~]# /opt/redis/bin/redis-cli save
redis.conf 的配置信息
1、daemonize 如果需要在后台运行,把该项改为yes
2、pidfile 配置多个pid的地址 默认在/var/run/redis.pid
3、bind 绑定ip,设置后只接受来自该ip的请求
4、port 监听端口,默认是6379
5、loglevel 分为4个等级:debug verbose notice warning
6、logfile 用于配置log文件地址
7、databases 设置数据库个数,默认使用的数据库为0
8、save 设置redis进行数据库镜像的频率。
9、rdbcompression 在进行镜像备份时,是否进行压缩
10、dbfilename 镜像备份文件的文件名
11、Dir 数据库镜像备份的文件放置路径
12、Slaveof 设置数据库为其他数据库的从数据库
13、Masterauth 主数据库连接需要的密码验证
14、Requriepass 设置 登陆时需要使用密码
15、Maxclients 限制同时使用的客户数量
16、Maxmemory 设置redis能够使用的最大内存
17、Appendonly 开启append only模式
18、Appendfsync 设置对appendonly.aof文件同步的频率(对数据进行备份的第二种方式)
19、vm-enabled 是否开启虚拟内存支持 (vm开头的参数都是配置虚拟内存的)
20、vm-swap-file 设置虚拟内存的交换文件路径
21、vm-max-memory 设置redis使用的最大物理内存大小
22、vm-page-size 设置虚拟内存的页大小
23、vm-pages 设置交换文件的总的page数量
24、vm-max-threads 设置VM IO同时使用的线程数量
25、Glueoutputbuf 把小的输出缓存存放在一起
26、hash-max-zipmap-entries 设置hash的临界值
27、Activerehashing 重新hash
redis【持久化】配置:
http://blog.csdn.net/vtopqx/article/details/46833513
1、rdb
save 900 1
save 300 10
save 60 10000
2、aof
appendfsync always
appendfsync everysec
appendfsync no
redis【主从】配置:
http://blog.csdn.net/yilukuangpao/article/details/52004257
vi etc/redis.conf
#绑定IP地址
bind 192.168.88.128
#若当前服务为slave,在此处设置主服务的ip及端口
slaveof 10.10.10.200 6379
#若当前服务为slave,设置主服务的认证密码
masterauth 01130229
127.0.0.1:6379> slaveof 10.10.10.200 6379
显示ok,也就OK了
redis【集群】配置:
http://blog.csdn.net/jhq0113/article/details/44134833
http://blog.csdn.net/zj0116/article/details/44673017
bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile /var/log/redis_6379.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /usr/local/redis
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
CentOS 编译安装 Redis (实测 笔记 Centos 7.3 + redis 3.2.8)的更多相关文章
- CentOS 编译安装 Nodejs (实测 笔记 Centos 7.3 + node 6.9.5)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- CentOS7 编译安装 Mongodb (实测 笔记 Centos 7.0 + Mongodb 2.6.6)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- CentOS7 编译安装 Nginx (实测 笔记 Centos 7.0 + nginx 1.6.2)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- CentOS7 编译安装 Mariadb (实测 笔记 Centos 7.0 + Mariadb 10.0.15)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- CentOS7 编译安装 Nodejs (实测 笔记 Centos 7.0 + node 0.10.33)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- Centos编译安装PHP 5.5笔记
本篇是在 Centos 6.4 32bit 下编译安装 php 5.5.5 的笔记,接上篇 Centos编译安装Apache 2.4.6笔记.php 5.5.x 和 centos 源里面的 php 5 ...
- CentOS编译安装NodeJS+Express
NodeJS是基于Chrome’s Javascript runtime,也就是Google V8引擎执行Javascript的快速构建网络服务及应用的平台,其优点有: 在CentOS编译安装Node ...
- nginx php-fpm安装配置 CentOS编译安装php7.2
CentOS编译安装php7.2 介绍: 久闻php7的速度以及性能那可是比php5系列的任何一版本都要快,具体性能有多好,建议还是先尝试下再说.如果你是升级或新安装,那你首先需要考虑php7和程序是 ...
- Redis学习笔记(2)——Redis的下载安装部署
一.下载Redis Redis的官网下载页上有各种各样的版本,如图 但是官网下载的Redis项目不正式支持Windows.如果需要再windows系统上部署,要去GitHub上下载.我下载的是Redi ...
随机推荐
- windows下Qt5.1 for android开发环境配置
1.下载安装Qt 5.1.0 for Android (Windows 32-bit, 716 MB) http://qt-project.org/downloads 2.打开Qt Creator ...
- vs/windows程序找不到入口点cuvidGetDecodeStatus于AppDecGL.exe动态链接库上
解决方法:这个问题的原因是由于使用的英伟达显卡驱动版本不够新,更新显卡驱动即可. 找了一个多月的原因,终于知道起源了.最终问题还是出在了nvcuvid.lib/.dll上面.通过分析vs调试信息可以得 ...
- tensorflow--交叉熵
学而不思则罔,思而不学则怠. 最近在看<TensorFlow 实战Google深度学习框架第二版>这本书.从头开始学习深度学习,对于细节方面进行探究.相当于重新拾起来这门”手艺“. 这篇随 ...
- kmp算法:
自学kmp算法: first time:wa #include<cstdio> #include<algorithm> #include<iostream> #in ...
- java gui 2
1,编写程序,随机生成两个数,用户输入两个数的和,并进行评判.程序的初始界面如下: 点击“获取题目”,随机生成两个100以内的int类型的数,界面如下: 提示: (1)使用java.util.Rand ...
- java中读取资源文件的方法
展开全部 1.使用java.util.Properties类的load()方法 示例: //文件在项目下.不是在包下!! InputStream in = new BufferedInputStrea ...
- python 将png图片格式转换生成gif动画
先看知乎上面的一个连接 用Python写过哪些[脑洞大开]的小工具? https://www.zhihu.com/question/33646570/answer/157806339 这个哥们通过爬气 ...
- POSIX共享内存
DESCRIPTION 共享内存是最快的可用IPC形式.它允许多个不相关(无亲缘关系)的进程去访问同一部分逻辑内存. 如果需要在两个进程之间传输数据,共享内存将是一种效率极高的解决方案.一旦这样的内存 ...
- python调用函数超时设置
1.Windows中sign报错,Linux能很好的使用: https://pypi.python.org/pypi/timeout-decorator 2.Windows可以使用,Linux报错不能 ...
- 平滑升级nginx到新版本
这里测试一下nginx的平滑升级,以备不时之需 查看nginx版本号: [root@zklf-server01 ~]# /application/nginx/sbin/nginx -V nginx v ...