日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢(xún)
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
Redis緩存文件儲(chǔ)存在何處(redis緩存文件在哪里)

Redis緩存文件儲(chǔ)存在何處?

在使用Redis作為緩存解決方案時(shí),我們都知道Redis會(huì)把緩存數(shù)據(jù)放入內(nèi)存中。不過(guò),當(dāng)緩存數(shù)據(jù)過(guò)多時(shí),Redis無(wú)法承受緩存數(shù)據(jù)全部放在內(nèi)存中,這時(shí)就需要將一部分緩存數(shù)據(jù)放到磁盤(pán)中。那么,Redis緩存文件儲(chǔ)存在何處呢?

Redis緩存文件的存儲(chǔ)位置是由Redis.conf配置文件的“dir”屬性所決定的。如果Redis.conf配置文件中沒(méi)有設(shè)置“dir”屬性,那么Redis會(huì)將緩存文件保存在Redis所處的目錄下。

Redis.conf配置文件中一般會(huì)設(shè)置以下三個(gè)屬性:

1. bind

這個(gè)屬性指定Redis綁定的IP地址。如果這個(gè)屬性沒(méi)有被設(shè)置,那么Redis默認(rèn)會(huì)監(jiān)聽(tīng)所有的IP地址。

2. port

這個(gè)屬性指定Redis監(jiān)聽(tīng)的端口。默認(rèn)端口是6379。

3. dir

這個(gè)屬性指定Redis所用到的文件目錄。當(dāng)Redis需要將緩存數(shù)據(jù)寫(xiě)入磁盤(pán)時(shí),就會(huì)將緩存數(shù)據(jù)存儲(chǔ)在“dir”所指定的目錄中。

以下是Redis.conf配置文件的部分示例:

bind 127.0.0.1 //指定Redis綁定的IP地址

port 6379 //指定Redis監(jiān)聽(tīng)的端口

dir /var/lib/redis/ //指定Redis緩存文件存儲(chǔ)的目錄

上面的示例中,“dir”屬性將Redis緩存文件存儲(chǔ)在了“/var/lib/redis/”目錄下。這個(gè)目錄需要能夠被Redis所運(yùn)行的用戶(hù)所訪問(wèn),否則Redis將無(wú)法將緩存數(shù)據(jù)寫(xiě)入磁盤(pán)。

此外,還有一個(gè)相關(guān)的屬性“dbfilename”,這個(gè)屬性用于指定Redis緩存文件的文件名。如果“dbfilename”屬性沒(méi)有被設(shè)置,默認(rèn)的文件名是“dump.rdb”。

以下是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 for Redis configuration files or you wish

# to store your Redis configuration files in a different directory

# (e.g. /etc/redis/redis.conf).

#

# Notice option “include” won’t be rewritten by command “CONFIG REWRITE”

# from admin or Redis Sentinel. Since Redis always uses the last processed

# configuration file, you are safe if the include is put at the

# beginning or somewhere else in the middle of the configuration file.

#

# 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 Redis listens for connections from all the network interfaces

# avlable on the server. It is possible to listen to just one or multiple

# 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 at 127.0.0.1 which is safer to use

#

# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES

# JUST COMMENT THE FOLLOWING LINE.

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#

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 Redis only accepts connections from “127.0.0.1”

# (IPv4 and IPv6), and from Unix domn 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.

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 rse both the value of somaxconn and tcp_max_syn_backlog

# in order to get the desired effect.

tcp-backlog 511

# Unix socket path.

#

# When the server is not run as root, Redis will fl to create its socket

# in /var/run/redis/redis.sock and will instead create it in /tmp/redis.sock

# unless the `unixsocket` option has been specified.

#

# Unix socket disabled by default

#

# 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 60 seconds.

tcp-keepalive 60

################################# SECURITY ####################################

# Require clients to issue AUTH before processing any other

# commands. This might be useful in environments in which you do not trust

# others with access to the host running redis-server.

#

# This should stay commented out for backward compatibility and because most

# people do not need auth (e.g. they run their own servers).

#

# Warning: since Redis is pretty fast an outside user can try up to

# 150k passwords per second agnst a good box. This means that you should

# use a very strong password otherwise it will be very easy to break.

#

# requirepass foobared

# Command renaming.

#

# It is possble to change the name of dangerous commands in a shared

# environment. For example the CONFIG command may be renamed into something

# hard to guess so that it will still be avlable for internal-use tools

# but not avlable for general clients.

#

# This is only useful if you have untrusted clients. No need to change

# this otherwise.

#

# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52

# rename-command CONFIG “”

# It is possible to completely kill a Redis server by sending it a wrong

# command line. Protect it with a password!

#

# rename-command DEBUG “”

################################### SNAPSHOTTING #####################################

# Save the DB on disk:

#

# save

#

# Will save the DB if both the given number of seconds and the given

# number of write operations agnst the DB occurred.

#

# In the example below the behaviour will be to save:

# after 900 sec (15 min) if at least 1 key changed

# after 300 sec (5 min) if at least 10 keys changed

# after 60 sec if at least 10000 keys changed

#

# Note: you can disable saving at all commenting all the “save” lines.

save 900 1

save 300 10

save 60 10000

# By

成都創(chuàng)新互聯(lián)科技有限公司,是一家專(zhuān)注于互聯(lián)網(wǎng)、IDC服務(wù)、應(yīng)用軟件開(kāi)發(fā)、網(wǎng)站建設(shè)推廣的公司,為客戶(hù)提供互聯(lián)網(wǎng)基礎(chǔ)服務(wù)!
創(chuàng)新互聯(lián)(www.cdcxhl.com)提供簡(jiǎn)單好用,價(jià)格厚道的香港/美國(guó)云服務(wù)器和獨(dú)立服務(wù)器。創(chuàng)新互聯(lián)——四川成都IDC機(jī)房服務(wù)器托管/機(jī)柜租用。為您精選優(yōu)質(zhì)idc數(shù)據(jù)中心機(jī)房租用、服務(wù)器托管、機(jī)柜租賃、大帶寬租用,高電服務(wù)器托管,算力服務(wù)器租用,可選線路電信、移動(dòng)、聯(lián)通機(jī)房等。


網(wǎng)站名稱(chēng):Redis緩存文件儲(chǔ)存在何處(redis緩存文件在哪里)
鏈接分享:http://www.5511xx.com/article/copjdjh.html