# Redis

Parses Redis’s configuration files

Author: Marc Fournier marc.f.nosp@m.ournier@camptoc.nosp@m.amp.com

Summary

Redis | Parses Redis’s configuration files
Reference | This lens is based on Redis’s default redis.conf
Usage Example |
License | This file is licensed under the LGPL v2+, like the rest of Augeas.
Augeas Lenses |
standard_entry | A standard entry is a key-value pair, separated by blank space, with optional blank spaces at line beginning & end.
save_entry | Entries identified by the “save” keyword can be found more than once.
replicaof_entry | Entries identified by the “replicaof” keyword can be found more than once.
sentinel_entry |
bind_entry | The “bind” entry can be passed one or several ip addresses.
save_entry | Entries identified by the “rename-command” keyword can be found more than once.
client_output_buffer_limit_entry | Entries identified by the “client-output-buffer-limit” keyword can be found more than once.
lns | The Redis lens

### Reference

This lens is based on Redis’s default redis.conf

### Usage Example

>     augtool> set /augeas/load/Redis/incl "/etc/redis/redis.conf"
>     augtool> set /augeas/load/Redis/lens "Redis.lns"
>     augtool> load

>     augtool> get /files/etc/redis/redis.conf/vm-enabled
>     /files/etc/redis/redis.conf/vm-enabled = no
>     augtool> print /files/etc/redis/redis.conf/rename-command[1]/
>     /files/etc/redis/redis.conf/rename-command
>     /files/etc/redis/redis.conf/rename-command/from = "CONFIG"
>     /files/etc/redis/redis.conf/rename-command/to = "CONFIG2"

>     augtool> set /files/etc/redis/redis.conf/activerehashing no
>     augtool> save
>     Saved 1 file(s)
>     augtool> set /files/etc/redis/redis.conf/save[1]/seconds 123
>     augtool> set /files/etc/redis/redis.conf/save[1]/keys 456
>     augtool> save
>     Saved 1 file(s)

The Test_Redis file also contains various examples.

### License

This file is licensed under the LGPL v2+, like the rest of Augeas.

### Augeas Lenses

### standard_entry

> let standard_entry = let reserved_k = "save" | "rename-command" | "replicaof" | "slaveof" | "bind" | "client-output-buffer-limit" | "sentinel" in let entry_noempty = [ indent . key (k - reserved_k) . del_ws_spc . Quote.do_quote_opt_nil (store v) . eol ] in let entry_empty = [ indent . key (k - reserved_k) . del_ws_spc . dquote . store "" . dquote . eol ] in entry_noempty | entry_empty

A standard entry is a key-value pair, separated by blank space, with optional blank spaces at line beginning & end. The value part can be optionnaly enclosed in single or double quotes. Comments at end-of-line ar NOT allowed by redis-server.

### save_entry

> let save_entry = [ indent . key save . save_val . eol ]

Entries identified by the “save” keyword can be found more than once. They have 2 mandatory parameters, both integers or a single parameter that is empty double quoted string. The same rules as standard_entry apply for quoting, comments and whitespaces.

### replicaof_entry

> let replicaof_entry = [ indent . key replicaof . del_ws_spc . ip . del_ws_spc . port . eol ]

Entries identified by the “replicaof” keyword can be found more than once. They have 2 mandatory parameters, the 1st one is an IP address, the 2nd one is a port number. The same rules as standard_entry apply for quoting, comments and whitespaces.

### sentinel_entry

> let sentinel_entry = indent . [ key "sentinel" . del_ws_spc . (sentinel_global_entry | sentinel_cluster_setup | sentinel_cluster_instance_setup | sentinel_clustering) ] . eol

### bind_entry

> let bind_entry = let ip = del_ws_spc . Quote.do_quote_opt_nil (store Rx.ip) in indent . [ key "bind" . [ label "ip" . ip ]+ ] . eol

The “bind” entry can be passed one or several ip addresses. A bind statement “bind ip1 ip2 .. ipn” results in a tree { “bind” { “ip” = ip1 } { “ip” = ip2 } ... { “ip” = ipn } }

### save_entry

Entries identified by the “rename-command” keyword can be found more than once. They have 2 mandatory parameters, both strings. The same rules as standard_entry apply for quoting, comments and whitespaces.

### client_output_buffer_limit_entry

> let client_output_buffer_limit_entry = [ indent . key cobl_cmd . del_ws_spc . class . del_ws_spc . hard_limit . del_ws_spc . soft_limit . del_ws_spc . soft_seconds . eol ]

Entries identified by the “client-output-buffer-limit” keyword can be found more than once. They have four mandatory parameters, of which the first is a string, the last one is an integer and the others are either integers or words, although redis is very liberal and takes “4242yadayadabytes” as a valid limit. The same rules as standard_entry apply for quoting, comments and whitespaces.

### lns

> let lns = (comment | empty | entry )*

The Redis lens

> let standard_entry = let reserved_k = "save" | "rename-command" | "replicaof" | "slaveof" | "bind" | "client-output-buffer-limit" | "sentinel" in let entry_noempty = [ indent . key (k - reserved_k) . del_ws_spc . Quote.do_quote_opt_nil (store v) . eol ] in let entry_empty = [ indent . key (k - reserved_k) . del_ws_spc . dquote . store "" . dquote . eol ] in entry_noempty | entry_empty

A standard entry is a key-value pair, separated by blank space, with optional blank spaces at line beginning & end.

> let save_entry = [ indent . key save . save_val . eol ]

Entries identified by the “save” keyword can be found more than once.

> let replicaof_entry = [ indent . key replicaof . del_ws_spc . ip . del_ws_spc . port . eol ]

Entries identified by the “replicaof” keyword can be found more than once.

> let sentinel_entry = indent . [ key "sentinel" . del_ws_spc . (sentinel_global_entry | sentinel_cluster_setup | sentinel_cluster_instance_setup | sentinel_clustering) ] . eol

> let bind_entry = let ip = del_ws_spc . Quote.do_quote_opt_nil (store Rx.ip) in indent . [ key "bind" . [ label "ip" . ip ]+ ] . eol

The “bind” entry can be passed one or several ip addresses.

> let client_output_buffer_limit_entry = [ indent . key cobl_cmd . del_ws_spc . class . del_ws_spc . hard_limit . del_ws_spc . soft_limit . del_ws_spc . soft_seconds . eol ]

Entries identified by the “client-output-buffer-limit” keyword can be found more than once.

> let lns = (comment | empty | entry )*

The Redis lens
Provides unit tests and examples for the Redis lens.
Close