国产成人精品18p,天天干成人网,无码专区狠狠躁天天躁,美女脱精光隐私扒开免费观看

最詳細的docker中安裝并配置redis(圖文詳解)

發(fā)布時(shí)間:2021-08-15 18:37 來(lái)源: 閱讀:0 作者:手撕代碼八百里 欄目: 服務(wù)器 歡迎投稿:712375056

一、找到一個(gè)合適的docker的redis的版本

可以去docker hub中去找一下

二、使用docker安裝redis

sudo docker pull redis

安裝好之后使用docker images即可查看

truedei@truedei:~$ 
truedei@truedei:~$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
redis               latest              987b78fc9e38        10 days ago         104MB
httpd               latest              a8a9cbaadb0c        2 weeks ago         166MB
fjudith/draw.io     latest              7b136fc80d31        3 weeks ago         683MB
mysql               5.7.29              f5829c0eee9e        5 weeks ago         455MB
truedei@truedei:~$ 
truedei@truedei:~$ 

三、準備redis的配置文件

因為需要redis的配置文件,這里最好還是去redis的官方去下載一個(gè)redis使用里面的配置文件即可

redis中文官方網(wǎng)站:

下載后解壓出來(lái):

這個(gè)redis.conf文件就是咱們需要的,為了保險,還是拷貝一下,做個(gè)備份。

四、配置redis.conf配置文件

修改redis.conf配置文件:
主要配置的如下:

bind 127.0.0.1 #注釋掉這部分,使redis可以外部訪(fǎng)問(wèn)
daemonize no#用守護線(xiàn)程的方式啟動(dòng)
requirepass 你的密碼#給redis設置密碼
appendonly yes#redis持久化  默認是no
tcp-keepalive 300 #防止出現遠程主機強迫關(guān)閉了一個(gè)現有的連接的錯誤 默認是300

五、創(chuàng )建本地與docker映射的目錄,即本地存放的位置

創(chuàng )建本地存放redis的位置;

可以自定義,因為我的docker的一些配置文件都是存放在/data目錄下面的,所以我依然在/data目錄下創(chuàng )建一個(gè)redis目錄,這樣是為了方便后期管理

truedei@truedei:redis-5.0.5$ sudo cp -p redis.conf /data/redis/
truedei@truedei:redis-5.0.5$ 

配置文件拷貝到剛才創(chuàng )建好的文件里

因為我本身就是Linux操作系統,所以我可以直接拷貝過(guò)去,如果你是windows的話(huà),可能需要使用ftp拷貝過(guò)去,或者直接復制內容,然后粘貼過(guò)去。

truedei@truedei:redis-5.0.5$ sudo cp -p redis.conf /data/redis/
truedei@truedei:redis-5.0.5$ 

六、啟動(dòng)docker redis

啟動(dòng):

truedei@truedei:~$ sudo docker run -p 6379:6379 --name redis -v /data/redis/redis.conf:/etc/redis/redis.conf  -v /data/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes

參數解釋?zhuān)?/p>

-p 6379:6379:把容器內的6379端口映射到宿主機6379端口
-v /data/redis/redis.conf:/etc/redis/redis.conf:把宿主機配置好的redis.conf放到容器內的這個(gè)位置中
-v /data/redis/data:/data:把redis持久化的數據在宿主機內顯示,做數據備份
redis-server /etc/redis/redis.conf:這個(gè)是關(guān)鍵配置,讓redis不是無(wú)配置啟動(dòng),而是按照這個(gè)redis.conf的配置啟動(dòng)
–appendonly yes:redis啟動(dòng)后數據持久化

七、查看是否啟動(dòng)成功

查看是否成功啟動(dòng):sudo docker ps

truedei@truedei:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
85cb7d83a2ff        redis               "docker-entrypoint.s…"   7 minutes ago       Up 7 minutes        0.0.0.0:6379->6379/tcp              redis
0a122a08125f        mysql:5.7.29        "docker-entrypoint.s…"   5 weeks ago         Up About an hour    0.0.0.0:3306->3306/tcp, 33060/tcp   mysql57
truedei@truedei:~$ 

可以查看一下日志:sudo docker logs redis

truedei@truedei:~$ sudo docker logs redis
1:C 29 May 2020 01:16:22.107 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 29 May 2020 01:16:22.107 # Redis version=6.0.3, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 29 May 2020 01:16:22.107 # Configuration loaded
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.0.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

1:M 29 May 2020 01:16:22.108 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 29 May 2020 01:16:22.108 # Server initialized
1:M 29 May 2020 01:16:22.108 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 29 May 2020 01:16:22.108 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 29 May 2020 01:16:22.108 * Ready to accept connections
truedei@truedei:~$ 

到此這篇關(guān)于最詳細的docker中安裝并配置redis(圖文詳解)的文章就介紹到這了,更多相關(guān)docker安裝配置redis內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。

无码高潮喷吹在线观看| 女高中生自慰污污网站| 中国少妇的BBB真爽| 亚洲AV无码久久| 日本日本熟妇中文在线视频| 消息称老熟妇乱视频一区二区|