Redis6.2.6安装

[root@software_server2 deps]# yum install gcc 
[root@software_server2 servers]# tar xf redis-6.2.6.tar.gz
[root@software_server2 servers]# mv redis-6.2.6 redis
[root@software_server2 servers]# cd redis/
[root@software_server2 redis]# cd  deps/jemalloc/
[root@software_server2 jemalloc]# ./configure
[root@software_server2 jemalloc]# make && make install_bin install_include install_lib
[root@software_server2 jemalloc]# cd ..
[root@software_server2 deps]# make lua hiredis linenoise
[root@software_server2 jemalloc]# cd ..
[root@software_server2 redis]# make install PREFIX=/usr/local/redis
[root@software_server2 redis]# printf "vm.overcommit_memory = 1\nnet.core.somaxconn = 512\n" >> /etc/sysctl.conf
[root@software_server2 redis]# cp redis.conf /usr/local/redis/
#需修改配置文件如下
bind 127.0.0.1 局域网IP
daemonize yes  #后台启动
dir /data/redis  #rdb目录
#启动服务
[root@software_server1 ~]# grep -Ev "^#|^$" /usr/local/redis/redis.conf 
bind 127.0.0.1 192.168.102.42
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
always-show-logo no
set-proc-title yes
proc-title-template "{title} {listen-addr} {server-mode}"
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir /data/redis
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
requirepass s48iy06iHr-uf6fjhj4s
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
lazyfree-lazy-user-flush no
oom-score-adj no
oom-score-adj-values 0 200 800
disable-thp yes
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 yes
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
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes
[root@software_server2 ~]# ./bin/redis-server  ./redis.conf
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
redis安装 1: 下载redis-5.0.4.tar.gz 2: 解压源码并进入目录 tar zxvf redis-5.0.4.tar.gz cd redis-5.0.4 3: 不用configure 4: 直接make (如果是32位机器 make 32bit) 查看linux机器是32位还是64位的方法:file /bin/ls 注:易碰到的问题,时间错误. 原因: 源码是官方configure过的,但官方configure时,生成的文件有时间戳信息, Make只能发生在configure之后, 如果你的虚拟机的时间不对,比如说是2012年 解决: date -s ' yyyy-mm-dd hh:mm:ss ' 重写时间 再 clock -w 写入cmos 5: 可选步骤: make test 测试编译情况 (可能出现: need tcl >8.4这种情况, yum -y install tcl ) 6: 安装到指定的目录,比如 /usr/local/redis make PREFIX=/usr/local/redis install 注: PREFIX要大写 7: 复制配置文件 cp redis.conf /usr/local/redis 注path为解压后的安装包路径 /root/gsj/redis-3.0.6 8: 让redis以后台进程的形式运行 vim /usr/local/redis/redis.conf 编辑redis.conf配置文件,修改如下内容; daemonize yes 9: make install之后,cd /usr/local/redis/bin得到如下几个文件 redis-benchmark 性能测试工具 redis-check-aof 日志文件检测工(比如断电造成日志损坏,可以检测并修复) redis-check-dump 快照文件检测工具,效果类上 redis-cli 客户端 redis-server 服务端 10: 启动与连接 启动redis并指定配置文件 cd /usr/local/redis ./bin/redis-server ./redis.conf #设置随机启动 vim /etc/rc.local 最后添加: /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf 连接: 用redis-cli cd /usr/local/redis/bin/ ./redis-cli #进入 exit /quit #退出 关闭redis pkill redis-server #关闭 ./redis-cli shutdown #关闭 查看是否启动成功 ps -ef | grep redis #查看端口是否占用 netstat -tunpl | grep 6379 11: 测试 String(字符串)类型: set name lijie #设置键name的值为lijie get name #获取name的值。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值