硬件:Raspberry Pi 4B(4g或8g版本)
系统:Ubuntu 20.04 LTS Docker:18.09.9
mysql镜像:arm64v8/redis:3.2.12
- 注意:因为我们树莓派4B本身并非x86,而是arm架构,且我们的系统装的是64位ubuntu,因此镜像只能选择arm64v8架构的镜像。
配置文件:/home/docker/server/redis/conf/redis.conf
logfile "/data/redis.log"
port 6379
appendonly yes
protected-mode yes
bind 0.0.0.0
tcp-backlog 511
timeout 0
tcp-keepalive 0
supervised no
loglevel notice
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
maxmemory-policy volatile-lru
数据目录:/home/docker/server/redis/data
- 启动redis
$ docker run -itd --name redis -p 6379:6379 --restart always --privileged=true -v /home/docker/server/redis/conf/redis.conf:/etc/redis/redis.conf -v /home/docker/server/redis/data:/data arm64v8/redis:3.2.12 redis-server /etc/redis/redis.conf
- 访问redis
$ docker exec -it redis bash
root@b635e03c995e:/data# redis-cli
127.0.0.1:6379> info
# Server
redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:201d0c859011ee79
redis_mode:standalone
os:Linux 5.4.0-1012-raspi aarch64
arch_bits:64
multiplexing_api:epoll
gcc_version:6.3.0
process_id:1
run_id:d823e898ae3700c33b30a3210f3e2c48abc95864
tcp_port:6379
uptime_in_seconds:112
uptime_in_days:0
hz:10
lru_clock:1502225
executable:/data/redis-server
config_file:/etc/redis/redis.conf
# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
# Memory
used_memory:855256
used_memory_human:835.21K
used_memory_rss:2969600
used_memory_rss_human:2.83M
used_memory_peak:855256
used_memory_peak_human:835.21K
total_system_memory:8190750720
total_system_memory_human:7.63G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:volatile-lru
mem_fragmentation_ratio:3.47
mem_allocator:jemalloc-4.0.3
# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1595337633
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:1
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_current_size:0
aof_base_size:0
aof_pending_rewrite:0
aof_buffer_length:0
aof_rewrite_buffer_length:0
aof_pending_bio_fsync:0
aof_delayed_fsync:0
# Stats
total_connections_received:1
total_commands_processed:1
instantaneous_ops_per_sec:0
total_net_input_bytes:47
total_net_output_bytes:9959
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
# CPU
used_cpu_sys:0.27
used_cpu_user:0.07
used_cpu_sys_children:0.01
used_cpu_user_children:0.00
# Cluster
cluster_enabled:0
# Keyspace
参考