五月综合激情婷婷六月,日韩欧美国产一区不卡,他扒开我内裤强吻我下面视频 ,无套内射无矿码免费看黄,天天躁,日日躁,狠狠躁

新聞動態(tài)

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

發(fā)布日期:2021-12-21 13:52 | 文章來源:站長之家

一、找到一個合適的docker的redis的版本

可以去docker hub中去找一下

https://hub.docker.com/_/redis?tab=tags

二、使用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的官方去下載一個redis使用里面的配置文件即可

redis中文官方網(wǎng)站:http://www.redis.cn/download.html

下載后解壓出來:

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

四、配置redis.conf配置文件

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

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

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

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

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

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

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

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

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

六、啟動docker redis

啟動:

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

參數(shù)解釋:

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

七、查看是否啟動成功

查看是否成功啟動: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內(nèi)容請搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!

版權(quán)聲明:本站文章來源標注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。

實時開通

自選配置、實時開通

免備案

全球線路精選!

全天候客戶服務

7x24全年不間斷在線

專屬顧問服務

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時在線

客服
熱線

400-630-3752
7*24小時客服服務熱線

關(guān)注
微信

關(guān)注官方微信
頂部