当前位置:网站首页>Set up [redis in centos7.x]
Set up [redis in centos7.x]
2022-07-07 01:30:00 【Curator Zang】
List of articles
Get ready
Use here redis-6.2.6 edition
install
Download and extract to the installation directory
[[email protected] local]# wget https://download.redis.io/releases/redis-6.2.6.tar.gz
[[email protected] local]# tar -zxf redis-6.2.6.tar.gz
[[email protected] local]# mv redis-6.2.6 redis
[[email protected] local]# ll
Total usage 2424
drwxrwxr-x. 7 root root 4096 10 month 4 2021 redis
-rw-r--r--. 1 root root 2476542 10 month 4 2021 redis-6.2.6.tar.gz
[[email protected] local]# cd redis
Check the compilation environment and install if there is no one
[[email protected] redis]# rpm -q gcc gcc-c++
Package not installed gcc
Package not installed gcc-c++
[[email protected] redis]# yum -y install gcc gcc-c++
Source code compilation
# Note that the working directory to perform compilation must be redis
# make install By default the bin Put it in /usr/local/bin/ below , Need to add PREFIX=/usr/local/redis/ Specify the directory
[[email protected] redis]# make && make install PREFIX=/usr/local/redis/
cd src && make install
make[1]: Entry directory “/usr/local/redis/src”
Modify the configuration
# Log path
[[email protected] redis]# mkdir log
# Modify the configuration
[[email protected] redis]# cp redis.conf redis.my.conf
[[email protected] redis]# vi redis.my.conf
bind 0.0.0.0
protected-mode no
daemonize yes
ogfile "/usr/local/redis/log/redis.log"
# Create services
[[email protected] redis]# vi /usr/lib/systemd/system/redisd.service
[Unit]
Description=redis
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.my.conf
ExecReload=/usr/local/redis/bin/redis-server -s reload
ExecStop=/usr/local/redis/bin/redis-server -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Start the service
# Check the current service status as follows
[[email protected] redis]# systemctl status redisd
● redisd.service - redis
Loaded: loaded (/usr/lib/systemd/system/redisd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
# Add boot entry
[[email protected] redis]# systemctl enable redisd
# Start the service
[[email protected] redis]# systemctl start redisd
# Check the current service status again
[[email protected] redis]# systemctl status redisd
● redisd.service - redis
Loaded: loaded (/usr/lib/systemd/system/redisd.service; enabled; vendor preset: disabled)
Active: active (running) since 5、 ... and 2022-05-13 13:05:55 CST; 27s ago
Main PID: 25766 (redis-server)
CGroup: /system.slice/redisd.service
└─25766 /usr/local/redis/bin/redis-server 0.0.0.0:6379
- Common commands :
- systemctl start redisd( start-up redis service )
- systemctl restart redisd( restart redis service )
- systemctl stop redisd( stop it redis service )
- systemctl enable redisd( Add power on self start )
- systemctl disable redisd( No auto start )
- systemctl status redisd( Check the status )
Open the firewall port
[[email protected] redis]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since 5、 ... and 2022-05-13 10:59:02 CST; 2h 42min ago
Docs: man:firewalld(1)
Main PID: 670 (firewalld)
CGroup: /system.slice/firewalld.service
└─670 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
[[email protected] redis]# firewall-cmd --zone=public --add-port=6379/tcp --permanent
success
[[email protected] redis]# firewall-cmd --reload
success
[[email protected] redis]# firewall-cmd --list-ports
6379/tcp
test
[[email protected] redis]# ./bin/redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set name zangh
OK
127.0.0.1:6379> get name
"zangh"
边栏推荐
- What does security capability mean? What are the protection capabilities of different levels of ISO?
- Neon Optimization: an optimization case of log10 function
- C # method of calculating lunar calendar date 2022
- 图片打水印 缩放 和一个输入流的转换
- Transformation transformation operator
- Sword finger offer II 035 Minimum time difference - quick sort plus data conversion
- Machine learning: the difference between random gradient descent (SGD) and gradient descent (GD) and code implementation.
- C语言实例_3
- According to the analysis of the Internet industry in 2022, how to choose a suitable position?
- Install Firefox browser on raspberry pie /arm device
猜你喜欢

LeetCode:1175. 质数排列

微信公众号发送模板消息
![[advanced C language] 8 written questions of pointer](/img/d4/c9bb2c8c9fd8f54a36e463e3eb2fe0.png)
[advanced C language] 8 written questions of pointer

JTAG principle of arm bare board debugging

Analysis of mutex principle in golang

云呐|工单管理软件,工单管理软件APP

Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman

Yunna | work order management software, work order management software app

Instructions for using the domain analysis tool bloodhound

shell脚本快速统计项目代码行数
随机推荐
Neon Optimization: an optimization case of log10 function
736. Lisp 语法解析 : DFS 模拟题
Share a general compilation method of so dynamic library
Machine learning: the difference between random gradient descent (SGD) and gradient descent (GD) and code implementation.
Oracle: Practice of CDB restricting PDB resources
图片打水印 缩放 和一个输入流的转换
golang 基础 —— 数据类型
Supersocket 1.6 creates a simple socket server with message length in the header
Analysis of mutex principle in golang
【信号与系统】
从底层结构开始学习FPGA----FIFO IP的定制与测试
2022 Google CTF SEGFAULT LABYRINTH wp
How to evaluate load balancing performance parameters?
Case development of landlord fighting game
Comparison of picture beds of free white whoring
NEON优化:性能优化常见问题QA
第三方跳转网站 出现 405 Method Not Allowed
免费白嫖的图床对比
Neon Optimization: an instruction optimization case of matrix transpose
Atomic in golang and CAS operations