最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

docker-compose安裝redis的方法步驟

 更新時(shí)間:2023年09月08日 09:36:19   作者:Roc-xb  
本文主要介紹了docker-compose安裝redis的方法步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

基于docker-compose快速安裝redis

一、目錄結(jié)構(gòu)

1、docker-compose.yml

version: '3'
services:
  redis:
    image: registry.cn-hangzhou.aliyuncs.com/zhengqing/redis:6.0.8                    # 鏡像'redis:6.0.8'
    container_name: redis                                                             # 容器名為'redis'
    restart: unless-stopped                                                                   # 指定容器退出后的重啟策略為始終重啟,但是不考慮在Docker守護(hù)進(jìn)程啟動(dòng)時(shí)就已經(jīng)停止了的容器
    command: redis-server /etc/redis/redis.conf --requirepass hcses.com --appendonly no # 啟動(dòng)redis服務(wù)并添加密碼為:123456,默認(rèn)不開(kāi)啟redis-aof方式持久化配置
#    command: redis-server --requirepass 123456 --appendonly yes # 啟動(dòng)redis服務(wù)并添加密碼為:123456,并開(kāi)啟redis持久化配置
    environment:                        # 設(shè)置環(huán)境變量,相當(dāng)于docker run命令中的-e
      TZ: Asia/Shanghai
      LANG: en_US.UTF-8
    volumes:                            # 數(shù)據(jù)卷掛載路徑設(shè)置,將本機(jī)目錄映射到容器目錄
      - "./redis/data:/data"
      - "./redis/config/redis.conf:/etc/redis/redis.conf"  # `redis.conf`文件內(nèi)容`http://download.redis.io/redis-stable/redis.conf`
    ports:                              # 映射端口
      - "6379:6379"

2、redis.conf

# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.
################################## INCLUDES ###################################
# Include one or more other config files here.  This is useful if you
# have a standard template that goes to all Redis servers but also need
# to customize a few per-server settings.  Include files can include
# other files, so use this wisely.
#
# Notice option "include" won't be rewritten by command "CONFIG REWRITE"
# from admin or Redis Sentinel. Since Redis always uses the last processed
# line as value of a configuration directive, you'd better put includes
# at the beginning of this file to avoid overwriting config change at runtime.
#
# If instead you are interested in using includes to override configuration
# options, it is better to use include as the last line.
#
# include /path/to/local.conf
# include /path/to/other.conf
################################## MODULES #####################################
# Load modules at startup. If the server is not able to load modules
# it will abort. It is possible to use multiple loadmodule directives.
#
# loadmodule /path/to/my_module.so
# loadmodule /path/to/other_module.so
################################## NETWORK #####################################
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 loopback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 注釋允許外部訪問(wèn)redis
# bind 127.0.0.1
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# 1) The server is not binding explicitly to a set of addresses using the
#    "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
# 開(kāi)啟保護(hù)模式后,需要 bind ip 或 設(shè)置密碼
protected-mode yes
# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379
# TCP listen() backlog.
#
# In high requests-per-second environments you need an high backlog in order
# to avoid slow clients connections issues. Note that the Linux kernel
# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# in order to get the desired effect.
tcp-backlog 511
# Unix socket.
#
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
# unixsocket /tmp/redis.sock
# unixsocketperm 700
# Close the connection after a client is idle for N seconds (0 to disable)
timeout 0
# TCP keepalive.
#
# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
# of communication. This is useful for two reasons:
#
# 1) Detect dead peers.
# 2) Take the connection alive from the point of view of network
#    equipment in the middle.
#
# On Linux, the specified value (in seconds) is the period used to send ACKs.
# Note that to close the connection the double of the time is needed.
# On other kernels the period depends on the kernel configuration.
#
# A reasonable value for this option is 300 seconds, which is the new
# Redis default starting with Redis 3.2.1.
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
always-show-logo yes
# 900秒內(nèi),如果超過(guò)1個(gè)key被修改,則發(fā)起快照保存
save 900 1
# 300秒內(nèi),如果超過(guò)10個(gè)key被修改,則發(fā)起快照保存
save 300 10
# 60秒內(nèi),如果1萬(wàn)個(gè)key被修改,則發(fā)起快照保存
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir ./
replica-serve-stale-data yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
# 設(shè)置密碼
# requirepass 123456
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
oom-score-adj no
oom-score-adj-values 0 200 800
appendonly no
# The name of the append only file (default: "appendonly.aof")
appendfilename "appendonly.aof"
# 每次操作都會(huì)立即寫(xiě)入aof文件中
# appendfsync always
# 每秒持久化一次(默認(rèn)配置)
appendfsync everysec
# 不主動(dòng)進(jìn)行同步操作,默認(rèn)30s一次
# appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes

二、連接使用

為了方便使用,建議下載個(gè)Redis Desktop Manager 可視化工具。

 到此這篇關(guān)于docker-compose安裝redis的方法步驟的文章就介紹到這了,更多相關(guān)docker-compose安裝redis內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • docker中實(shí)現(xiàn) push到私有倉(cāng)庫(kù)

    docker中實(shí)現(xiàn) push到私有倉(cāng)庫(kù)

    配置Docker Registry并設(shè)置Nginx訪問(wèn),需調(diào)整客戶(hù)端配置支持HTTP(指定端口80),避免默認(rèn)443端口錯(cuò)誤,建議啟用HTTPS提升安全性,處理帶認(rèn)證的倉(cāng)庫(kù)推送
    2025-08-08
  • docker安裝redis掛載容器卷同時(shí)開(kāi)啟持久化

    docker安裝redis掛載容器卷同時(shí)開(kāi)啟持久化

    本文主要介紹了docker安裝redis掛載容器卷同時(shí)開(kāi)啟持久化,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-06-06
  • 解決docker啟動(dòng)容器失敗:cannot?access‘/docker-entrypoint-initdb.d/‘:Operation?not?permitted

    解決docker啟動(dòng)容器失敗:cannot?access‘/docker-entrypoint-initdb.d/‘:

    這篇文章主要介紹了解決docker啟動(dòng)容器失敗:cannot?access‘/docker-entrypoint-initdb.d/‘:Operation?not?permitted,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-05-05
  • docker拉取clickhouse鏡像的方法實(shí)現(xiàn)

    docker拉取clickhouse鏡像的方法實(shí)現(xiàn)

    本文主要介紹了docker拉取clickhouse鏡像的方法實(shí)現(xiàn),解決從DockerHub拉取鏡像時(shí)的網(wǎng)絡(luò)連接問(wèn)題,具有一定的參考價(jià)值,感興趣的可以了解一下
    2025-03-03
  • docker中通過(guò)nginx+confd動(dòng)態(tài)生成配置的解決方案

    docker中通過(guò)nginx+confd動(dòng)態(tài)生成配置的解決方案

    這篇文章主要介紹了docker:nginx+confd動(dòng)態(tài)生成配置,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-03-03
  • Docker環(huán)境下的Apache NiFi安裝實(shí)踐及遇到問(wèn)題解決方案

    Docker環(huán)境下的Apache NiFi安裝實(shí)踐及遇到問(wèn)題解決方案

    由于最近用到數(shù)據(jù)同步,故打算采用中間件工具來(lái)做數(shù)據(jù)同步,誰(shuí)知第一步部署Apache NiFi環(huán)境就耽擱了好久,其中遇到一些問(wèn)題,故記錄下來(lái)部署成功記錄,下面給大家詳細(xì)介紹Docker環(huán)境下的Apache NiFi安裝實(shí)踐及遇到問(wèn)題解決方案,感興趣的朋友一起看看吧
    2025-05-05
  • Docker?部署?vue?項(xiàng)目的詳細(xì)流程

    Docker?部署?vue?項(xiàng)目的詳細(xì)流程

    使用Docker配合Nginx部署Vue3項(xiàng)目涉及多個(gè)步驟:首先安裝Nginx,然后創(chuàng)建掛載目錄及配置文件;接著打包Vue項(xiàng)目并上傳至服務(wù)器;最后創(chuàng)建Dockerfile,構(gòu)建鏡像并啟動(dòng)容器,部署完成后,通過(guò)IP訪問(wèn)應(yīng)用以驗(yàn)證是否成功
    2024-09-09
  • Docker安裝MinIO詳細(xì)步驟介紹

    Docker安裝MinIO詳細(xì)步驟介紹

    大家好,本篇文章主要講的是Docker安裝MinIO詳細(xì)步驟介紹,感興趣的同學(xué)趕快來(lái)看一看吧,對(duì)你有幫助的話記得收藏一下,方便下次瀏覽
    2021-12-12
  • 解決docker安裝后運(yùn)行hello-world報(bào)錯(cuò)的問(wèn)題

    解決docker安裝后運(yùn)行hello-world報(bào)錯(cuò)的問(wèn)題

    這篇文章主要介紹了解決docker安裝后運(yùn)行hello-world報(bào)錯(cuò)的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-11-11
  • 使用Docker部署MySQL的實(shí)現(xiàn)步驟

    使用Docker部署MySQL的實(shí)現(xiàn)步驟

    本文主要介紹了Docker部署MySQL的實(shí)現(xiàn)步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-08-08

最新評(píng)論

广德县| 贵州省| 南乐县| 甘泉县| 中山市| 山西省| 宜州市| 金昌市| 涞源县| 连城县| 万盛区| 西平县| 本溪市| 沅陵县| 乾安县| 称多县| 达拉特旗| 富顺县| 元氏县| 宣武区| 西乡县| 齐齐哈尔市| 五原县| 保康县| 丹江口市| 同德县| 高邑县| 连山| 虎林市| 铜陵市| 砚山县| 通许县| 宜章县| 剑河县| 浦城县| 光山县| 塘沽区| 荃湾区| 台东市| 环江| 宁安市|