garnet使用简介
qingheluo2024-10-14清河洛324
garnet使用简介Garnet是微软研发的开源缓存存储软件,可作为redis的替代,特别是在redis开源协议修改之后及官方不支持windows系统Garnet采用了redis相同的RESP有线协议,这使得Garnet可以通过现有的redis客户端进行连接和操作Garnet的官方github开源网址:点击打开运行Garnet需要.NET运行时,点击下载Garnet兼容目前大部分的redis命令和配置信息Garnet的官方编译程序名称为"GarnetServer.exe",在此我们重命名为"garnet.exe"(非必须)Garnet的启动Garnet通过命令行直接启动Garnet目前支...
garnet使用简介
Garnet是微软研发的开源缓存存储软件,可作为redis的替代,特别是在redis开源协议修改之后及官方不支持windows系统
Garnet采用了redis相同的RESP有线协议,这使得Garnet可以通过现有的redis客户端进行连接和操作
Garnet的官方github开源网址:点击打开
运行Garnet需要.NET运行时,点击下载
Garnet兼容目前大部分的redis命令和配置信息
Garnet的官方编译程序名称为"GarnetServer.exe",在此我们重命名为"garnet.exe"(非必须)
Garnet的启动
Garnet通过命令行直接启动
Garnet目前支持自配置文件格式(json格式)和redis配置文件格式两种
采用garnet格式配置文件
garnet --config-import-path <garnet.conf>
采用redis格式配置文件
garnet --config-import-path <redis.conf> --config-import-format RedisConf
增加了--config-import-format RedisConf配置项
Garnet的配置文件
Garnet的配置文件中所有配置项均可通过启动时的命令行参数指定
如果配置文件和启动命令均指定同一个配置项,则以命令行指定的值为准
.cont-table{width:100%;}
.cont-table ul {width:100%; float:left;}
.cont-table ul:nth-child(odd){background:#efe;}
.cont-table ul:nth-child(1){background:none; font-weight: bold;}
.cont-table ul li{border:#ddd 1px solid; text-align:center; line-height:1.3rem;float:left;height:100%;}
.cont-table ul li:nth-child(1){width:15%;}
.cont-table ul li:nth-child(2){width:25%;}
.cont-table ul li:nth-child(3){width:10%;}
.cont-table ul li:nth-child(4){width:48%;}
- 配置项
- 命令行参数
- 类型
- 介绍
- Port
- --port
- int
- 监听端口号
- Address
- --bind
- string
- 绑定网卡地址
- MemorySize
- -m / --memory
- string
- 允许使用的最大内存,如"5g"、"600m"
- PageSize
- -p / --page
- string
- 指定内存页大小
- SegmentSize
- -s / --segment
- string
- 指定内存分段大小
- MutablePercent
- --mutable-percent
- int
- 可变数据(需要频繁访问和更新)的百分比数值
- EnableStorageTier
- --storage-tier
- bool
- 启用根据数据访问频率分层存储,热数据存储在快速介质,冷数据存储在较慢但容量更大介质
- CopyReadsToTail
- --copy-reads-to-tail
- bool
- 在读取数据时,复制最新数据到缓存末尾,减少后续读取延迟,提高缓存命中率
- LogDir
- -l / --logdir
- string
- 指定分层存储的目录,默认为当前所在目录
- CheckpointDir
- -c / --checkpointdir
- string
- 数据快照(持久化)保存目录,不指定默认使用LogDir
- Recover
- -r / --recove
- bool
- 从最新的数据快照中恢复
- DisablePubSub
- --no-pubsub
- bool
- 禁用发布/订阅功能
- EnableIncrementalSnapshots
- --incsnap
- bool
- 启用增量快照,仅记录自上次快照以来发生的变化,减少存储需求和快照生成时间,提高效率
- DisableObjects
- --no-obj
- bool
- 禁用对象,禁用后不支持数据结构对象
- EnableCluster
- --cluster
- bool
- 启用集群
- CleanClusterConfig
- --clean-cluster-config
- bool
- 清理不再使用或过时的集群配置项,降低故障风险,提高性能
- AuthenticationMode
- --auth
- NoAuth, Password, Aad, ACL
- 指定如何进行用户身份验证
- Password
- --password
- string
- 用于密码身份验证的密码
- ClusterUsername
- --cluster-username
- string
- 用于验证群集内通信的用户名
- ClusterPassword
- --cluster-password
- string
- 用于验证集群内通信的密码
- EnableAOF
- --aof
- bool
- 启用日志记录
- AofMemorySize
- --aof-memory
- string
- 最大AOF内存缓冲区大小,超过此限制后溢出到磁盘
- CommitFrequencyMs
- --aof-commit-freq
- string
- aof日志的提交频率(毫秒),0表示每个操作立即提交,-1表示只有运行COMMITAOF命令才提交
- EnableFastCommit
- --fast-commit
- bool
- 开启快速提交,可以更快速的提交aof日志,降低延迟
- WaitForCommit
- --aof-commit-wait
- bool
- 等待aof提交,然后再将结果返回给客户端,将大大增加操作延迟
- AofSizeLimit
- --aof-size-limit
- string
- aof日志最大大小,不指定将无限制地增长
- CompactionFrequencySecs
- --compaction-freq
- int
- 后台对数据的压缩频率(秒),0表示禁用(此时在保存快照时才会执行压缩)
- CompactionType
- --compaction-type
- None, Scan, Lookup
- 数据压缩方法,Scan扫描旧页面并将实时记录移动到结尾,Lookup在压缩范围内查找每条记录,用于使用哈希链进行记录活动检查
- CompactionForceDelete
- --compaction-force-delete
- bool
- 数据压缩后是否立即删除非活动数据
- EnableTLS
- --tls
- bool
- 启用 TLS
- CertFileName
- --cert-file-name
- string
- TLS 证书文件
- CertPassword
- --cert-password
- string
- TLS 证书密码
- CertSubjectName
- --cert-subject-name
- string
- TLS 证书使用者名称
- CertificateRefreshFrequency
- --cert-refresh-freq
- int
- TLS证书刷新频率(秒),0表示禁用
- ClientCertificateRequired
- --client-certificate-required
- bool
- 是否需要 TLS 客户端证书
- CertificateRevocationCheckMode
- --certificate-revocation-check-mode
- NoCheck、Online、Offline
- 证书验证的证书吊销检查模式
- MetricsSamplingFrequency
- --metrics-sampling-freq
- int
- 指标采样频率(秒),0表示禁用指标监控
- QuietMode
- -q
- bool
- 安静模式启动
- LogLevel
- --logger-level
- LogLevel
- 日志级别,Trace、Debug、Information、Warning、Error、Critical 和 None
- DisableConsoleLogger
- --disable-console-logger
- bool
- 禁用控制台日志输出
- FileLogger
- --file-logger
- string
- 指定运行日志文件
- ThreadPoolMinThreads
- --minthreads
- int
- 线程池中的最小工作线程数和完成线程数,0 使用系统默认值
- ThreadPoolMaxThreads
- --maxthreads
- int
- 线程池中的最大工作线程数和完成线程数,0 使用系统默认值
- CheckpointThrottleFlushDelayMs
- --checkpoint-throttle-delay
- int
- 控制数据快照创建频率(秒),-1表示禁用
- NetworkSendThrottleMax
- --network-send-throttle
- int
- 限制单个回话的最大网络连接数
- ConfigImportPath
- --config-import-path
- string
- 默认配置文件检索目录
- ConfigImportFormat
- --config-import-format
- 配置文件格式,GarnetConf(默认)、RedisConf
- ConfigExportFormat
- --config-export-format
- ConfigFileType
- 将配置选项格式化之后导时的导出格式
- ConfigExportPath
- --config-export-path
- string
- 将配置选项格式化之后导时的导出目录
- UseNativeDeviceLinux
- --use-native-device-linux
- bool
- 在Linux上使用本机设备进行本地存储