redis 配置说明

Megalinter 初体验 MegaLinter 是一个多语言、多工具的集成代码检查工具,它能够通过一个统一的工作流来运行多个静态代码分析工具,从而提供全面的代码质量检查。 阅读详情
 

#是否以后台进程运行,默认为no,如果需要以后台进程运行则改为yes

daemonize no

#如果以后台进程运行的话,就需要指定pid,你可以在此自定义redis.pid文件的位置。

pidfile /var/run/redis.pid

#接受连接的端口号,如果端口是0则redis将不会监听TCP socket连接

port 6379

# If you want you can bind a single interface, if the bind option is not

# specified all the interfaces will listen for incoming connections.

#

# bind 127.0.0.1

# 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 755

#连接超时时间,单位秒。(0 to disable)?

timeout 300000000

#日志级别,默认是verbose(详细),各种日志级别:

#debug:很详细的信息,适合开发和测试

#verbose:包含许多不太有用的信息,但比debug要清爽一些(many rarely useful info, but not a mess like #the debug level)

#notice:比较适合生产环境

#warning:警告信息

loglevel verbose

#指定log文件的名字,默认是stdout。stdout会让redis把日志输出到标准输出。但是如果使用stdout而又以后台进#程的方式运行redis,则日志会输出到/dev/null

logfile stdout

#'syslog-enabled'设置为yes会把日志输出到系统日志,默认是no

# syslog-enabled no

#指定syslog的标示符,如果'syslog-enabled'是no,则这个选项无效。

# syslog-ident redis

#指定syslog 设备(facility), 必须是USER或者LOCAL0到LOCAL7.

# syslog-facility local0

#设置数据库数目。默认的数据库是DB 0。可以通过SELECT <dbid>来选择一个数据库,dbid是[0,'databases'-1]的数字

databases 16

################## 快照#################################

# 硬盘上保存数据:

#   save <seconds> <changes>

#   <seconds>和<changes>都满足时就会触发数据保存动作。

#   以下面的例子来说明:

#   过了900秒并且有1个key发生了改变 就会触发save动作

#   过了300秒并且有10个key发生了改变 就会触发save动作

#   过了60秒并且至少有10000个key发生了改变 也会触发save动作

#   注意:如果你不想让redis自动保存数据,那就把下面的配置注释掉!

save 900 1

save 300 10

save 60 10000

#存储数据时是否压缩数据。默认是yes。

rdbcompression yes

# 保存dump数据的文件名

dbfilename dump.rdb

# 工作目录.

# 数据会被持久化到这个目录下的‘dbfilename’指定的文件中。

# 注意,这里指定的必须是目录而不能是文件。

dir ./

######## REPLICATION(复制,冗余)#################################

# Master-Slave replication. 使用slaveof把一个 Redis 实例设置成为另一个Redis server的从库(热备). 注意: #配置只对当前slave有效。

# 因此可以把某个slave配置成使用不同的时间间隔来保存数据或者监听其他端口等等。

#命令格式:

# slaveof <masterip> <masterport>

#如果master有密码保护,则在slave与master进行数据同步之前需要进行密码校验,否则master会拒绝slave的请#求。

# masterauth <master-password>

#当slave丢失与master的连接时,或者slave仍然在于master进行数据同步时(还没有与master保持一致),#slave可以有两种方式来响应客户端请求:

# 1) 如果 slave-serve-stale-data 设置成 'yes' (the default) slave会仍然响应客户端请求,此时可能会有问题。

# 2) 如果 slave-serve-stale data设置成  'no'  slave会返回"SYNC with master in progress"这样的错误信息。 但 INFO 和SLAVEOF命令除外。

slave-serve-stale-data yes

############### 安全 ###################################

# 需要客户端在执行任何命令之前指定 AUTH <PASSWORD>

# requirepass foobared

# 命令重命名.

# 例如:

# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52

# 同样可以通过把一个命令重命名为空串来彻底kill掉这个命令,比如:

# rename-command CONFIG ""

#################### 限制 ####################################

# 设置最大连接数. 默认没有限制,  '0' 意味着不限制.

# maxclients 128

#最大可使用内存。如果超过,Redis会试图删除EXPIRE集合中的keys,具体做法是:Redis会试图释放即将过期的#keys,而保护还有很长生命周期的keys。

#如果这样还不行,Redis就会报错,但像GET之类的查询请求还是会得到响应。

#警告:如果你想把Redis视为一个真正的DB的话,那不要设置<maxmemory>,只有你只想把Redis作为cache或者

#有状态的server('state' server)时才需要设置。

# maxmemory <bytes>

#内存清理策略:如果达到了maxmemory,你可以采取如下动作:

# volatile-lru -> 使用LRU算法来删除过期的set

# allkeys-lru -> 删除任何遵循LRU算法的key

# volatile-random ->随机地删除过期set中的key

# allkeys->random -> 随机地删除一个key

# volatile-ttl -> 删除最近即将过期的key(the nearest expire time (minor TTL))

# noeviction -> 根本不过期,写操作直接报错

# 默认策略:

# maxmemory-policy volatile-lru

# 对于处理redis内存来说,LRU和minor TTL算法不是精确的,而是近似的(估计的)算法。所以我们会检查某些样本#来达到内存检查的目的。默认的样本数是3,你可以修改它。

# maxmemory-samples 3

################# APPEND ONLY MODE ###############################

#默认情况下,Redis会异步的把数据保存到硬盘。如果你的应用场景允许因为系统崩溃等极端情 况而导致最新数据丢失#的话,那这种做法已经很ok了。否则你应该打开‘append only’模式,开启这种模式后,Redis会在#appendonly.aof文件中添加每一个写操作,这个文件会在Redis启动时被读取来在内存中 重新构建数据集。

#注意:如果你需要,你可以同时开启‘append only’模式和异步dumps模式(你需要注释掉上面的‘save’表达式来禁#止dumps),这种情况下,Redis重建数据集时会优先使用appendonly.aof而忽略dump.rdb

appendonly no

#  append only 文件名 (默认: "appendonly.aof")

# appendfilename appendonly.aof

# 调用fsync()函数通知操作系统立刻向硬盘写数据

# Redis支持3中模式:

# no:不fsync, 只是通知OS可以flush数据了,具体是否flush取决于OS.性能更好.

# always: 每次写入append only 日志文件后都会fsync . 性能差,但很安全.

# everysec: 没间隔1秒进行一次fsync. 折中.

# 默认是 "everysec"

# appendfsync always

appendfsync everysec

# appendfsync no

# 当AOF fsync策略被设置为always或者everysec并且后台保存进程(saving process)正在执行大量I/O操作时

# Redis可能会在fsync()调用上阻塞过长时间

no-appendfsync-on-rewrite no

# append only 文件的自动重写

# 当AOF 日志文件即将增长到指定百分比时,Redis可以通过调用BGREWRITEAOF 来自动重写append only文件。

# 它是这么干的:Redis会记住最近一次重写后的AOF 文件size。然后它会把这个size与当前size进行比较,如果当前# size比指定的百分比大,就会触发重写。同样,你需要指定AOF文件被重写的最小size,这对避免虽然百分比达到了# 但是实际上文件size还是很小(这种情况没有必要重写)却导致AOF文件重写的情况很有用。

# auto-aof-rewrite-percentage 设置为 0 可以关闭AOF重写功能

auto-aof-rewrite-percentage 100

auto-aof-rewrite-min-size 64mb

################## SLOW LOG ###################################

# Redis slow log用来记录超过指定执行时间的查询。

# 你可以指定两个参数:一个是慢查询的阀值,单位是毫秒;另外一个是slow log的长度,相当于一个队列。

# 负数则关闭slow log,0则会导致每个命令都被记录

slowlog-log-slower-than 10000

# 不设置会消耗过多内存,所以还是要设置一下。可以使用SLOWLOG RESET命令来回收slow log使用的内存

slowlog-max-len 1024

################ 虚拟内存 ###############################

#使用redis 就别用虚拟内存了,绝对不是一个好主意,加个机器吧,所以这里不翻译啦!!

### WARNING! Virtual Memory is deprecated in Redis 2.4

### The use of Virtual Memory is strongly discouraged.

# Virtual Memory allows Redis to work with datasets bigger than the actual

# amount of RAM needed to hold the whole dataset in memory.

# In order to do so very used keys are taken in memory while the other keys

# are swapped into a swap file, similarly to what operating systems do

# with memory pages.

# To enable VM just set 'vm-enabled' to yes, and set the following three

# VM parameters accordingly to your needs.

vm-enabled no

# vm-enabled yes

# This is the path of the Redis swap file. As you can guess, swap files

# can't be shared by different Redis instances, so make sure to use a swap

# file for every redis process you are running. Redis will complain if the

# swap file is already in use.

# The best kind of storage for the Redis swap file (that's accessed at random) 

# is a Solid State Disk (SSD).

# *** WARNING *** if you are using a shared hosting the default of putting

# the swap file under /tmp is not secure. Create a dir with access granted

# only to Redis user and configure Redis to create the swap file there.

vm-swap-file /tmp/redis.swap

# vm-max-memory configures the VM to use at max the specified amount of

# RAM. Everything that deos not fit will be swapped on disk *if* possible, that

# is, if there is still enough contiguous space in the swap file.

# With vm-max-memory 0 the system will swap everything it can. Not a good

# default, just specify the max amount of RAM you can in bytes, but it's

# better to leave some margin. For instance specify an amount of RAM

# that's more or less between 60 and 80% of your free RAM.

vm-max-memory 0

# Redis swap files is split into pages. An object can be saved using multiple

# contiguous pages, but pages can't be shared between different objects.

# So if your page is too big, small objects swapped out on disk will waste

# a lot of space. If you page is too small, there is less space in the swap

# file (assuming you configured the same number of total swap file pages).

# If you use a lot of small objects, use a page size of 64 or 32 bytes.

# If you use a lot of big objects, use a bigger page size.

# If unsure, use the default :)

vm-page-size 32

# Number of total memory pages in the swap file.

# Given that the page table (a bitmap of free/used pages) is taken in memory,

# every 8 pages on disk will consume 1 byte of RAM.

# The total swap size is vm-page-size * vm-pages

# With the default of 32-bytes memory pages and 134217728 pages Redis will

# use a 4 GB swap file, that will use 16 MB of RAM for the page table.

# It's better to use the smallest acceptable value for your application,

# but the default is large in order to work in most conditions.

vm-pages 134217728

 

# Max number of VM I/O threads running at the same time.

# This threads are used to read/write data from/to swap file, since they

# also encode and decode objects from disk to memory or the reverse, a bigger

# number of threads can help with big objects even if they can't help with

# I/O itself as the physical device may not be able to couple with many

# reads/writes operations at the same time.

# The special value of 0 turn off threaded I/O and enables the blocking

# Virtual Memory implementation.

vm-max-threads 4

################高级配置###############################

# Hashes are encoded in a special way (much more memory efficient) when they

# have at max a given numer of elements, and the biggest element does not

# exceed a given threshold. You can configure this limits with the following

# configuration directives.

hash-max-zipmap-entries 512

hash-max-zipmap-value 64

# Similarly to hashes, small lists are also encoded in a special way in order

# to save a lot of space. The special representation is only used when

# you are under the following limits:

list-max-ziplist-entries 512

list-max-ziplist-value 64

# Sets have a special encoding in just one case: when a set is composed

# of just strings that happens to be integers in radix 10 in the range

# of 64 bit signed integers.

# The following configuration setting sets the limit in the size of the

# set in order to use this special memory saving encoding.

set-max-intset-entries 512

# Similarly to hashes and lists, sorted sets are also specially encoded in

# order to save a lot of space. This encoding is only used when the length and

# elements of a sorted set are below the following limits:

zset-max-ziplist-entries 128

zset-max-ziplist-value 64

# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in

# order to help rehashing the main Redis hash table (the one mapping top-level

# keys to values). The hash table implementation redis uses (see dict.c)

# performs a lazy rehashing: the more operation you run into an hash table

# that is rhashing, the more rehashing "steps" are performed, so if the

# server is idle the rehashing is never complete and some more memory is used

# by the hash table.

# The default is to use this millisecond 10 times every second in order to

# active rehashing the main dictionaries, freeing memory when possible.

# If unsure:

# use "activerehashing no" if you have hard latency requirements and it is

# not a good thing in your environment that Redis can reply form time to time

# to queries with 2 milliseconds delay.

# use "activerehashing yes" if you don't have such hard requirements but

# want to free memory asap when possible.

activerehashing yes

################## INCLUDES ###################################

# Include one or more other config files here.  This is useful if you

# have a standard template that goes to all redis server but also need

# to customize a few per-server settings.  Include files can include

# other files, so use this wisely.

# include /path/to/local.conf

# include /path/to/other.conf

Redis配置文件参数说明(redis.conf) daemonize no 默认情况下,redis不是在后台运行的。如果需要在后台运行,把该项的值更改为yes。 pidfile /var/run/redis.pid 当redis在后台运行的时候,redis默认会把pid文件放在/var/run/redis.pid,你可以配置到其他位置。当运行多个redis服务时,需要指定不同的pid文件和端口。 port 6379 指定redis运行的端口,默认是6379。 bind 127.0.0.1 指定redis只接收来自于该IP地址的请求看,如果不.. 阅读详情

相关推荐

redis简介以及配置说明

【代码】redis简介以及配置说明。

alankuo的专栏 571

java打印 X XXX XXXXX

public class Test3 { int i = 0; int n = 3; while (i < n) { //打印空格 n-i-1个 for (int j = 0; j < n - i - 1; j++) { System.out.print(" "); } //打印X i*2+1个 .

qq_50292797的博客 13万+

Redis(十):sentinel.conf 配置文件说明

# Example sentinel.conf # *** IMPORTANT *** # 绑定IP地址 # bind 127.0.0.1 192.168.1.1 # 保护模式(是否禁止外部链接,除绑定的ip地址外) # protected-mode no # port <sentinel-port> # 此Sentinel实例运行的端口 port 26379 # 默认情况下,R...

码客 1万+

java.lang.NoSuchFieldError: No static field septal_line3 of type I in class com/example/xxxxx/xxxxxx

03-27 08:41:48.942 29308-29308/com.xx.xxxxxxxxxxxxx E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xx.xxxxxxxxxxxxx, PID: 29308 java.lang.NoSuchFieldError: No static field septal_line3 ...

sinat_35958166的博客 19万+

redis安装配置说明

本文介绍了在CentOS 6.4 x86系统上安装和配置Redis数据库的步骤。Redis是一个开源的、基于内存的键值存储系统,支持多种编程语言的API。安装过程包括解压Redis软件包、编译源代码、复制相关文件和配置文件到指定目录。配置文件中设置了Redis的运行参数,如端口号、日志文件路径、最大内存使用量等。启动Redis服务后,可以通过redis-cli命令进行数据库管理,包括查看服务器信息、管理客户端连接、保存数据、清空数据库等操作。此外,还介绍了如何监控慢查询日志和管理日志信息。

yeahzxw的博客 110

QGC二次开发实战指南(一):从零构建自定义地面站界面

本文详细介绍了QGC二次开发实战指南,从零开始构建自定义地面站界面。通过QT和QML技术结合MAVLINK协议,开发者可以打造适合特定业务场景的无人机监控系统,提升操作效率与用户体验。文章包含环境搭建、界面设计、数据绑定等完整开发流程,是QGC二次开发的实用教程。

weixin_28693683的博客 496

xxxxxx

 xxxxxxxxxx

zhaoyulong8873的专栏 6万+

samba源码编译安装(版本4.13.0)

这里写目录标题前言编译安装samba下载三个包安装依赖共需要安装samba、gnutls、nettle1、进入解压后的samba目录执行:2、进入解压后的gnutls目录执行3、进入解压后的nettle目录执行3.1 卸载已存在nettle3.2 编译3.3 make3.4 安装4、进入gnutls继续编译4.1 编译4.2 make4.3 安装5、再次进入解压后的samba目录5.1 执行./configure5.2 make5.3 samba安装启动samba 前言 一般来说,安装samba最快的方式应

灵葱的博客 1万+

Redis(九):redis.conf 配置文件说明

# Redis 配置文件. # # 请注意,为了读取配置文件,必须以文件路径作为第一个参数启动Redis: # # ./redis-server /path/to/redis.conf # 内存大小单位 # # 1k => 1000 bytes # 1kb => 1024 bytes # 1m => 1000000 bytes # 1mb => 1024*1024 byt...

码客 3158

【IC设计实战】去耦电容decap在电源完整性中的关键作用与选型策略

本文深入探讨了去耦电容(decap)在IC设计电源完整性中的核心作用。文章分析了decap如何通过提供本地电荷缓冲来抑制电源噪声与电压波动,并详细阐述了其选型与布局策略,包括MIM、MOM、MOS电容的特性对比,以及如何权衡峰值抑制与建立速度的矛盾,为设计稳定可靠的芯片电源系统提供实践指导。

weixin_29233857的博客 248

BERTopic模型入门教程(附代码+参数调节)

BERTopic 是一种用于从文本数据中提取主题模型的新型方法。通过结合 BERT嵌入和传统的主题模型来生成语义丰富的主题。传统的主题模型(如LDA)主要依赖于词频矩阵,而 BERTopic 通过预训练语言模型生成高维语义嵌入来捕捉词语间的复杂关系,因此可以更好地处理上下文信息。BERTopic模型可以看作是创建其主题表示的一系列步骤。核心原理如下:就本质而言,BERTopic就是一个拼装框架,可以把每部分都替换成其他模型,只要完成任务即可。

m0_52069102的博客 1万+

redis配置参数说明

文章目录1.standalone配置说明和分析(单机配置说明)1.1 总体配置1.2 最大内存及策略1.3 aof相关配置1.4 rdb相关配置1.5 慢查询配置1.6 数据结构优化配置1.7 复制replication相关配置1.8 客户端相关配置1.9 安全相关配置2.sentinel哨兵配置(略,因为用的是集群)3.cluster配置说明和分析4.info系统状态说明 1.standalone配置说明和分析(单机配置说明) 1.1 总体配置 补充: 1)watchdog-period 已被移除

谢白羽 1108

程序员实战:DINOv3 权重文件下载与本地化部署全流程指南

Meta开源的DINOv3视觉大模型凭借70亿参数和17亿图像训练,在语义分割、目标检测等任务表现优异。本文详解预训练权重的获取渠道、校验方法和加载实践。开发者可通过HuggingFace或GitHub获取不同版本权重,包括针对服务器端的ViT系列和边缘设备的ConvNeXt系列。文章提供MD5校验代码确保文件完整性,并给出PyTorch和Transformers两种加载方式。特别强调7B模型需16GB GPU内存,建议根据硬件条件选择合适版本,如边缘设备使用ConvNeXt-Tiny。最后指出DINOv3

xiugou3365的博客 5908

redis配置文件(redis.conf)详细说明文档

我最近发现了一个redis配置文件(redis.conf)的详细说明文档发到网上以供大家浏览和查阅

分享计算机编程开发技术、面试技巧、面试笔试题、IT技术、计算机学习资源、计算机毕业设计论文等等。 1176

Codex,Copilot 是什么

GitHub Copilot是什么 **GitHub Copilot** 是一款由 **GitHub** 和 **OpenAI** 合作开发的 **AI 代码辅助工具**,它基于 **OpenAI Codex 技术**,能够根据上下文自动生成代码建议,大幅提升编程效率

ZhangJiqun&191cm&85kg 6815

2026华为OD面试题029:勇攀数字高峰

在给定的数字地形图里寻找登山路径,数字代表当前位置的海拔高度。要求从最低海拔出发,不断攀登,最终到达最高山峰。地图保证最低海拔和最高山峰都只有一个。 登山规则: - 路径上的海拔必须严格递增 - 只能向上下左右 4 个方向移动 - 路径必须从最低海拔开始,到最高海拔结束 - 每个地点只能走一次 - 每一步的攀登高度差必须大于 0,且不超过指定值 `K` 输出满足条件的登山路径的数量。

琅嬛福地 120

Redis 配置文件说明

Redis配置文件(redis.conf)详解:1) 支持bytes单位配置;2) 包含网络设置(bind IP、端口6379、连接队列等)和安全验证;3) 通用配置包括后台进程、日志级别、数据库数量;4) 资源限制包含最大连接数(maxclients)、内存上限(maxmemory)及淘汰策略(LRU/随机等)。生产环境需注意远程访问安全设置、内存限制和持久化配置。

L_qingting的博客 1241

【C语言学习疑难杂症】第20期:0x00007FF7F2821964处引发的异常0xC0000005写入位置 0x0000000000000

检查代码中是否存在野指针访问的情况,确保在进行写入操作之前,内存已经被正确分配或初始化,并且在使用完毕后进行了正确的释放。空指针访问:代码尝试在空指针地址(0x0000000000000000)处进行写入操作,导致访问冲突。检查代码中是否存在数组越界的情况,确保在进行写入操作之前,数组的索引值在合法范围内。检查代码中是否存在空指针访问的情况,确保在进行写入操作之前,指针已经被正确初始化。野指针访问:代码尝试在已释放或未初始化的内存地址进行写入操作,导致访问冲突。

学无止境 828

Redis及其Sentinel配置项详细说明

一、redis.conf 配置项说明如下: 1、Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程,也就是后台运行。 daemonize no 2、当Redis以守护进程方式运行时,Redis默认会把pid写入/var/run/redis.pid文件,可以通过pidfile指定 pidfile /var/run/redis.pid 3、 指定Redis监听端口,默认端口为6379,作者在自己的一篇博文中解释了为什么选用6379作为默认端口,因为6379在手机按键上MER

男人要霸气的博客 3596

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Redis常用配置参数说明

Redis关键参数配置摘要 核心参数概览 repl-diskless-load:控制副本节点加载RDB数据的方式,默认disabled(安全写入磁盘)。可选on-empty-db(空库时内存加载)和实验性的swapdb(内存双缓冲,风险较高)。 repl-backlog-ttl:设置从节点全断开后复制积压缓冲区的保留时间(默认3600秒),0表示永久保留。需配合repl-backlog-size使用。 active-expire-effort:调节主动过期键检测的CPU投入(1-10),默认1。值越高清理越

buxin_2008的专栏 950

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Redis常见配置说明

参数说明 redis.conf 配置项说明如下: Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程 daemonize no 当Redis以守护进程方式运行时,Redis默认会把pid写入/var/run/redis.pid文件,可以通过pidfile指定 pidfile /var/run/redis.pid 指定Redis监听端口,默认端口为6379,作者在自己的一篇博文中解释了为什么选用6379作为默认端口,因为6379在手机按键上MERZ对

weixin_44651555的博客 388

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Redis 从入门到精通之Redis配置说明

redis.conf 是 Redis 的配置文件,用于配置 Redis 实例的各种参数和选项。Redis 实例启动时会读取该配置文件,并按照文件中的配置参数进行初始化。通用设置:如是否以守护进程方式运行 Redis、监听的端口号、监听的地址等。连接设置:如客户端连接超时时间、是否开启 TCP keepalive 等。通信协议设置:如 TCP listen() 函数的等待队列长度、Unix 套接字文件路径等。通用配置项:如日志记录级别、日志文件路径、Redis 数据库数量等。

qq_27615455的博客 5853

redis各项配置说明

Redis 的配置文件位于 Redis 安装目录下,文件名为 redis.conf(Windows 名为 redis.windows.conf)。 序号 配置项 说明 1 daemonize no Redis 默认不是以守护进程的方式运行,可以通过该配置项修改,使用 yes 启用守护进程(Windows 不支持守护线程的配置为 no,一般此配置会被注释,并说明此配置再windows上不可用。 ) 2 pidfile /var/run/redis.pid 当 Redis 以守护进程方式运行

Jesusloveus的博客 355

Redis的安装与常用配置说明

1.redis安装步骤   1)、下载,上传到Linux服务器,并解压   2)、预编译(实际上是检查编译环境的过程)   进入目录: cd /opt/soft/redis-3.2.9/deps/jemalloc   执行预编译 ./configure 在预编译的过程中,会检测安装redis所需的相关依赖,依次安装即可。 ...

weixin_34399060的博客 106

redis配置说明

################################## NETWORK ##################################### # 设置允许访问的IP,支持设置多个IP.# 不设置表示所有IP都可访问,127.0.0.1表示只能本地访问# 默认不设置# bind 192.168.1.100 10.0.0.1# bind 127.0.0.1 ::1 # yes ...

weixin_33749131的博客 105

Redis服务配置文件 redis.conf 更新修改配置参数说明

在安装redis服务中,默认的配置项通常不能实际使用,需要修改一些配置参数。1、拿到 redis.cnf 文件,此文件通常在 redis 项目源码的第一级目录下。4、如果搭建集群,常见问题可以参考。2、单实例,常规配置如下,

hkl_Forever的博客 2530
上一篇: 三.redis 排序
下一篇: Gearman 并行分布式计算框架
fankys
博客等级 码龄16年 0粉丝 7原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值