当前位置:网站首页>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"
边栏推荐
- 云呐|工单管理办法,如何开展工单管理
- 2022 Google CTF SEGFAULT LABYRINTH wp
- Realize incremental data synchronization between MySQL and ES
- 736. LISP syntax parsing: DFS simulation questions
- Neon Optimization: About Cross access and reverse cross access
- LeetCode. 剑指offer 62. 圆圈中最后剩下的数
- Add the applet "lazycodeloading": "requiredcomponents" in taro,
- Meet in the middle
- AcWing 1148. 秘密的牛奶运输 题解(最小生成树)
- 405 method not allowed appears when the third party jumps to the website
猜你喜欢
LeetCode:1175. 质数排列
Force buckle 1037 Effective boomerang
2022 Google CTF SEGFAULT LABYRINTH wp
1123. The nearest common ancestor of the deepest leaf node
Instructions for using the domain analysis tool bloodhound
Go zero micro service practical series (IX. ultimate optimization of seckill performance)
移植DAC芯片MCP4725驱动到NUC980
Let's see through the network i/o model from beginning to end
454-百度面经1
Clickhouse fields are grouped and aggregated, and SQL is queried according to the granularity of any time period
随机推荐
Dark horse notes - exception handling
Telnet,SSH1,SSH2,Telnet/SSL,Rlogin,Serial,TAPI,RAW
Google发布安全更新,修复Chrome中已被利用的0 day
2022 Google CTF SEGFAULT LABYRINTH wp
uva 1401 dp+Trie
黑马笔记---异常处理
MySQL script batch queries all tables containing specified field types in the database
Neon Optimization: About Cross access and reverse cross access
如何管理分布式团队?
公钥\私人 ssh避password登陆
Neon Optimization: summary of performance optimization experience
Share a general compilation method of so dynamic library
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
mysqlbackup 还原特定的表
修改px4飞控的系统时间
The difference between spin and sleep
NEON优化:性能优化常见问题QA
【C语言进阶篇】指针的8道笔试题
C语言实例_4
C language instance_ four