当前位置:网站首页>Linux环境 redis完整配置及启动命令
Linux环境 redis完整配置及启动命令
2022-07-29 14:55:00 【飞翔的佩奇】
1、redis.conf文件 需要改动的地方
(1)bind 86.10.113.8 此处为你自己的地址
################################## MODULES #####################################
# Load modules at startup. If the server is not able to load modules
# it will abort. It is possible to use multiple loadmodule directives.
#
# loadmodule /path/to/my_module.so
# loadmodule /path/to/other_module.so
################################## NETWORK #####################################
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 loopback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 86.10.113.8
(2) daemonize no 改为 daemonize yes 以后台静默进程启动
################################# GENERAL #####################################
# 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.
daemonize yes
(3)protected-mode yes 把yes改为no
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# 1) The server is not binding explicitly to a set of addresses using the
# "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
#
# 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.
protected-mode yes
2、启动服务
方式一、
重启redis服务
systemctl restart redis.service
设置redis服务为开机自启
systemctl enable redis.service
查看redis是否启动成功
ps aux | grep redis
systemctl status redis
方式二、
启动服务
/usr/local/bin/redis-server /etc/redis/redis.conf
查看redis是否启动成功
ps -ef|grep redis
边栏推荐
猜你喜欢

走高质量、可持续的保障亿万家庭之路 水滴公司发布2020·2021ESG报告

力扣每日一题-第45天-682. 棒球比赛

苹果涉险过关,全靠iPhone 13

韦伯首批照片引发论文竞速大战:晚13秒即错失首发,科研党纷纷肝得起飞

AOP implementation enterprise API access interface monitoring (via Google Guava cache data)

图斑自上而下,自左而右顺序编码,按照权属单位代码分组,每组从1开始编码

数字孪生万物可视 |联接现实世界与数字空间

NLP自然语言处理-机器学习和自然语言处理介绍(一)

Linux installation of MySQL (super detailed)

这 6 款在线 PDF 转换工具,得试
随机推荐
数据分析(二)
如何获取本地json
【yolov7系列二】正负样本分配策略
Principles Of Mathematical Analysis, Third Edition免费下载地址
LeetCode·每日一题·593.有效的正方形·数学
什么是异构计算
广州消防:高温天气火灾频发 消防安全不容忽视
Mysql数据库及表的建立
用Asm生成Class字节码文件
【LeetCode】88. 合并两个有序数组
I quit my job after cutting the brothers, and turned to do a small clerk
建议尽快优化搜索体验
MySQL索引常见面试题(2022版)
分析Nacos配置及源码
Guangzhou Emergency Management Bureau released the top ten safety risks of hazardous chemicals in summer
NLP自然语言处理-机器学习和自然语言处理介绍(一)
基于JSP&Servlet实现的众筹平台系统
MySQL Index Common Interview Questions (2022 Edition)
LeetCode·621.任务调度器·构造法
SkiaSharp 之 WPF 自绘 弹动小球(案例版)