Discourse PR for redis.socketed.template.yml

Decided to help out some folks at meta regarding using unix domain dockets for Redis, so I worked on this new Discourse configuration and got it working and tested today:

PR:

1 Like

Implementation Notes:

  1. If concerned about security of the Redis DB on the host, there is no need to expose this unix socket in the shared volume.

  2. If you wish to set the permissions of the unix socket to 770 (instead of 777) , change the group of the unix socket to www-data. (Having some issues with pups and chgrp in the yml templates)

One of the cool things we can do with Redis running on a unix socket which is shared outside the Discourse docker container is to monitor Redis is real-time:

# cd /var/discourse
# redis-cli -s ./shared/standalone/tmp/redis.sock monitor

This gives us a real-time monitor of Redis, like this example output:

Here is another cool thing to do from the cli:

redis ./shared/standalone/tmp/redis.sock> info
# Server
redis_version:5.0.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:df6b74e5e33d6955
redis_mode:standalone
os:Linux 5.4.0-26-generic x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:8.3.0
process_id:638
run_id:467389fb2e1df851e86a92da9e4d3958e75e66ac
tcp_port:0
uptime_in_seconds:7101
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:14454625
executable:/usr/bin/redis-server
config_file:/etc/redis/redis.conf

# Clients
connected_clients:34
client_recent_max_input_buffer:4
client_recent_max_output_buffer:0
blocked_clients:5

# Memory
used_memory:6689184
used_memory_human:6.38M
used_memory_rss:9900032
used_memory_rss_human:9.44M
used_memory_peak:6892416
used_memory_peak_human:6.57M
used_memory_peak_perc:97.05%
used_memory_overhead:1537690
used_memory_startup:792336
used_memory_dataset:5151494
used_memory_dataset_perc:87.36%
allocator_allocated:6747448
allocator_active:7372800
allocator_resident:10338304
total_system_memory:2084278272
total_system_memory_human:1.94G
used_memory_lua:50176
used_memory_lua_human:49.00K
used_memory_scripts:2448
used_memory_scripts_human:2.39K
number_of_cached_scripts:4
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:1.09
allocator_frag_bytes:625352
allocator_rss_ratio:1.40
allocator_rss_bytes:2965504
rss_overhead_ratio:0.96
rss_overhead_bytes:-438272
mem_fragmentation_ratio:1.48
mem_fragmentation_bytes:3211888
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:706442
mem_aof_buffer:0
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0

# Persistence
loading:0
rdb_changes_since_last_save:1143
rdb_bgsave_in_progress:0
rdb_last_save_time:1591512751
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:0
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:1146880
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
aof_last_cow_size:0

# Stats
total_connections_received:51
total_commands_processed:113693
instantaneous_ops_per_sec:20
total_net_input_bytes:9061485
total_net_output_bytes:3774761
instantaneous_input_kbps:1.57
instantaneous_output_kbps:0.22
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:30
expired_stale_perc:0.00
expired_time_cap_reached_count:0
evicted_keys:0
keyspace_hits:21194
keyspace_misses:17998
pubsub_channels:1
pubsub_patterns:0
latest_fork_usec:350
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0

# Replication
role:master
connected_slaves:0
master_replid:0bdf07d113717cc3525b26db2410abf534f6f40d
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:11.041099
used_cpu_user:10.522004
used_cpu_sys_children:0.138786
used_cpu_user_children:0.794560

# Cluster
cluster_enabled:0

# Keyspace
db0:keys=504,expires=338,avg_ttl=13106507625
redis ./shared/standalone/tmp/redis.sock> 

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.