欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

華為歐拉openEuler編譯安裝Redis的實(shí)現(xiàn)步驟

 更新時(shí)間:2023年01月03日 10:46:26   作者:李昊哲小課  
本文主要介紹了華為歐拉openEuler編譯安裝Redis的實(shí)現(xiàn)步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

升級(jí)系統(tǒng)

yum -y update

安裝依賴和常用工具

yum -y install tar vim net-tools wget gcc make lrzsz

下載安裝包

wget https://download.redis.io/redis-stable.tar.gz

解壓縮安裝包

tar -zxvf redis-stable.tar.gz

進(jìn)入解壓目錄后編譯安裝

cd redis-stable
make PREFIX=/usr/local/redis install 

創(chuàng)建配置文件目錄

mkdir /usr/local/redis/conf

拷貝配置文件模板

cp redis.conf /usr/local/redis/conf/

修改配置文件

vim /usr/local/redis/conf/redis.conf
#修改綁定IP
bind 0.0.0.0
#修改啟動(dòng)方式為多線程模式
daemonize yes
#設(shè)置密碼 requirepass foobared
requirepass 123456

修改服務(wù)啟動(dòng)文件

cd /lib/systemd/system
vim redis.service

服務(wù)啟動(dòng)文件內(nèi)容

[Unit]
Description=Redis
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

重新加載service文件

systemctl daemon-reload 

啟動(dòng)redis

systemctl start redis

開機(jī)自啟動(dòng)redis

systemctl enable redis

測(cè)修改環(huán)境變量

vim /etc/profile

export REDIS_HOME=/usr/local/redis
export PATH=$PATH:$REDIS_HOME/bin

source /etc/profile

測(cè)試

redis-cli
AUTH 123456
info server

防火墻開放端口

–zone #作用域

–add-port=1935/tcp #添加端口,格式為:端口/通訊協(xié)議

–permanent #永久生效,沒(méi)有此參數(shù)重啟后失效

firewall-cmd --zone=public --add-port=6379/tcp --permanent

重啟防火墻

firewall-cmd --reload 

連接遠(yuǎn)程服務(wù)器 -h 遠(yuǎn)程服務(wù)器地址 -p 遠(yuǎn)程服務(wù)器端口號(hào) --raw 避免中文亂碼

redis-cli -h localhost -p 6379 --raw?

#檢測(cè)redis服務(wù)是否啟動(dòng) 正常啟動(dòng)后響應(yīng)信息為pong
ping

#查看信息 info [section]
info

#查看服務(wù)器信息
info Server

Redis添加認(rèn)證

#修改配置文件
sudo vim /etc/redis/redis.conf?
#將配置文件中bing 127.0.0.1 ::1修改為bind 0.0.0.0 0:0:0:0:0:0:0:0指定任意主機(jī)都可以訪問(wèn)
#將配置文件中requirepass foobared 去掉注釋 foobared修改為修改后的密碼,例如requirepass 123456
#保存修改后的配置文件重啟redis服務(wù)
sudo systemctl restart redis
#連接遠(yuǎn)程服務(wù)器 -h 遠(yuǎn)程服務(wù)器地址 -p 遠(yuǎn)程服務(wù)器端口號(hào) -a 密碼
redis-cli -h localhost -p 6379 --raw -a "123456"
#無(wú)密碼連接遠(yuǎn)程服務(wù)器 -h 遠(yuǎn)程服務(wù)器地址 -p 遠(yuǎn)程服務(wù)器端口號(hào)
redis-cli -h localhost -p --raw 6379?
#連接成功后 使用密碼認(rèn)證 auth 密碼 提示OK通過(guò)認(rèn)證
auth 123456

#或者使用config命令
config set requirepass 123456
config get requirepass

到此這篇關(guān)于華為歐拉openEuler編譯安裝Redis的實(shí)現(xiàn)步驟的文章就介紹到這了,更多相關(guān)openEuler編譯安裝Redis內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論