linux部署redis

1.下载

官网https://redis.io/

在这里插入图片描述

2.安装

上传源码包至服务器
    
//1.解压
tar xzvf  redis-6.2.5.tar.gz
//2.进入目录安装
make
//3.可执行文件安装编译到指定目录
make install PREFIX=/usr/local/redis

3.配置

开启redis服务可远程访问,不开启则只指定母体机访问使用

IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
JUST COMMENT OUT THE FOLLOWING LINE.

配置  注释掉 #bind 127.0.0.1 -::1  (该句指定访问ip,也可在此配置能访问此redis服务的ip)

关闭redis保护模式,如不关闭同样不支持远程访问

By default protected mode is enabled. You should disable it only if
you are sure you want clients from other hosts to connect to Redis
even if no authentication is configured, nor a specific set of interfaces
#are explicitly listed using the “bind” directive. 与bind命令搭配,开启远程访问

配置      
protected-mode no

设置redis后台守护进程启动,默认非守护进程

By default Redis does not run as a daemon. Use ‘yes’ if you need it.
Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
When Redis is supervised by upstart or systemd, this parameter has no impact.
大致意思为Redis 不作为守护进程运行,如使用守护进程则配置yes

配置      
protected-mode no

自定义redis 端口,密码

开启远程后一定要配置密码.否则极有可能会被恶意扫码登录后 裸漏服务器

端口:
	port 3003
密码 
    requirepass Xnnf@123

启动

//指定配置文件启动
	redis-server ./redis.conf 
//指定配置文件参数启动,如端口是3303启动
	redis-server ./redis.conf  --port 3303
//redis暴力关闭
 	ps -ef | group redis
	kill -9 端口 
//redis命令关闭
	redis-cli -h 127.0.0.1 -p 6379 shutdown
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值