redis運維(三)redis6.0.8安裝
(1)官網下載穩定版本
wget http://download.redis.io/releases/redis-6.0.8.tar.gz
(2)安裝文件
1)yum安裝gcc
redis6.0.0+ '需要' gcc到'5.3及以上版本'
通過'安裝devtoolset的方式'間接升級gcc'指定'版本
------ '安裝指定版本gcc' ------
yum -y install centos-release-scl
# 安裝指定版本 yum -y install devtoolset-{7,8,9}-gcc*
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
注意:scl命令啟用只是'臨時的',退出shell或重啟'就會恢復原系統gcc版本'
需求:如果要長期使用對應版本的gcc,寫入系統指令碼,'永久生效' -->'非必須' -->'注意這裡的數字9'
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
2)編譯安裝redis
tar -zxf redis-6.0.8.tar.gz
cd redis-6.0.8
'安裝systemd的開發包'
yum install -y systemd-devel
'編譯' -->'systemd管理'
make USE_SYSTEMD=yes
'編譯安裝'到'指定目錄' -->移動檔案到'指定目錄'
make install
'進入工具目錄'
cd utils/
cp systemd-redis_server.service /etc/systemd/system/
-------'redis-trib.rb'-------
redis-6.0.8/src/redis-trib.rb
make PREFIX=/usr/local/redis install
make install --> '預設是移動到' --> '/usr/local/bin/' -->'跟service檔案適配'
'判斷是否有該使用者'
id redis || (groupadd redis && useradd redis -M -g redis -s /sbin/nologin)
'解釋':useradd -M '不建立主目錄' -s '不允許登入' /sbin/nologin redis -g '加入redis組' redis
修改配置檔案
sed -i /etc/systemd/system/systemd-redis_server.service --> '修改'
'/usr/lib/systemd/system目錄'
'注意' notify 會失敗,'換成 forking 方式啟動',讓主程式'複製一個子程式'的方式執行
27
34 Type=forking
38 User=redis
39 Group=redis
------ 'redis.conf'的位置 ------
vim redis-6.0.8/redis.conf -->最好移動到/etc目錄 -->'chown redis /etc/redis.conf'
# 將 no 改為 yes,表示以'後臺方式啟動'服務
225 daemonize yes
# 將 no 改為 systemd,表示以 'CentOS systemd' 系統服務方式啟動
236 supervised systemd
------ 'sentinel.conf'的位置 ------
redis-6.0.8/sentinel.conf -->-->最好移動到'/etc'目錄 -->'chown redis /etc/sentinel.conf'
service檔案
1 # example systemd service unit file for redis-server
2 #
3 # In order to use this as a template for providing a redis service in your
4 # environment, _at the very least_ make sure to adapt the redis configuration
5 # file you intend to use as needed (make sure to set "supervised systemd"), and
6 # to set sane TimeoutStartSec and TimeoutStopSec property values in the unit's
7 # "[Service]" section to fit your needs.
8 #
9 # Some properties, such as User= and Group=, are highly desirable for virtually
10 # all deployments of redis, but cannot be provided in a manner that fits all
11 # expectable environments. Some of these properties have been commented out in
12 # this example service unit file, but you are highly encouraged to set them to
13 # fit your needs.
14 #
15 # Please refer to systemd.unit(5), systemd.service(5), and systemd.exec(5) for
16 # more information.
17
18 [Unit]
19 Description=Redis data structure server
20 Documentation=https://redis.io/documentation
21 #Before=your_application.service another_example_application.service
22 #AssertPathExists=/var/lib/redis
23 Wants=network-online.target
24 After=network-online.target
25
26 [Service]
27 ExecStart=/usr/local/bin/redis-server /etc/redis.conf --supervised systemd
28 ## Alternatively, have redis-server load a configuration file:
29 #ExecStart=/usr/local/bin/redis-server /path/to/your/redis.conf
30 LimitNOFILE=10032
31 NoNewPrivileges=yes
32 #OOMScoreAdjust=-900
33 #PrivateTmp=yes
34 Type=forking
# TimeoutStartSec=infinity
# TimeoutStopSec=infinity
37 UMask=0077
38 User=redis
39 Group=redis
# WorkingDirectory=/var/lib/redis
41
42 [Install]
43 WantedBy=multi-user.target
'日誌檔案需要自己建立' -->並且'修改屬性'
chown redis.redis /var/log/redis-server.log
相關文章
- redis安裝和運維Redis運維
- GitLab 安裝、管理、運維Gitlab運維
- MongoDB日常運維-02安裝MongoDB運維
- Postgresql日常運維-安裝(Linux)01SQL運維Linux
- Postgresql日常運維-安裝(Windows)02SQL運維Windows
- 使用Docker安裝Redis - 學習三DockerRedis
- redis運維手冊Redis運維
- Redis 相關運維操作Redis運維
- 【redis安裝】Redis
- Redis 安裝Redis
- redis安裝Redis
- 安裝RedisRedis
- Mac安裝Redis,詳細redis安裝步驟MacRedis
- Redis效能分析和運維工具Redis運維
- redis哨兵,叢集和運維Redis運維
- 【Redis】Windows下安裝RedisRedisWindows
- 美創運維日記|SQL Server安裝後,需立即修改的三個引數運維SQLServer
- openGauss DBMind自治運維繫統的安裝和部署運維
- Mac Redis安裝與解除安裝MacRedis
- Redis 5.0 安裝Redis
- Redis安裝教程Redis
- Centos 安裝RedisCentOSRedis
- Mac安裝RedisMacRedis
- docker安裝redisDockerRedis
- Contos 安裝 RedisRedis
- Mac 安裝 RedisMacRedis
- redis安裝(linux)RedisLinux
- RockyLinux安裝redisLinuxRedis
- windows安裝RedisWindowsRedis
- docker 安裝 redisDockerRedis
- linux 安裝redisLinuxRedis
- ubuntu安裝redisUbuntuRedis
- 這 4 種 Redis 常用運維工具都不會?你算啥運維人Redis運維
- 40道 Redis 運維面試題Redis運維面試題
- Redis日常運維-基礎認識Redis運維
- Redis日常運維-引數詳解Redis運維
- Redis Manager Build Redis 安裝包RedisUI
- docker-compose安裝redis一主二從三哨兵DockerRedis