Hi, I’m trying to deploy Redis with redis_exporter. When I check the monitoring, it shows redis_up 1
. However, when I try to connect using redis-cli
, my connection is denied. What could be the problem here? I tested everything locally, and it works fine.
here’s my fly.toml
primary_region = 'hkg'
[http_service]
internal_port = 9092
force_https = true
[[services]]
internal_port = 6379
protocol = "tcp"
[[services.ports]]
port = 6379
[[vm]]
size = 'shared-cpu-1x'
memory = "512mb"
here’s my dockerfile
FROM redis:6.2.6
RUN apt-get update && \
apt-get install -y procps wget && \
rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/oliver006/redis_exporter/releases/download/v1.43.0/redis_exporter-v1.43.0.linux-amd64.tar.gz && \
tar xzf redis_exporter-v1.43.0.linux-amd64.tar.gz && \
mv redis_exporter-v1.43.0.linux-amd64/redis_exporter /usr/local/bin/ && \
rm -rf redis_exporter-v1.43.0.linux-amd64*
ADD redis.conf /usr/local/etc/redis/redis.conf
ADD start-redis-server.sh /usr/bin/
RUN chmod +x /usr/bin/start-redis-server.sh
EXPOSE 6379 9092
CMD ["start-redis-server.sh"]
and here’s the start-redis-server.sh
#!/bin/sh
sysctl vm.overcommit_memory=1
sysctl net.core.somaxconn=1024
# redis-server /usr/local/etc/redis/redis.conf --requirepass $REDIS_PASSWORD
redis-server /usr/local/etc/redis/redis.conf & \
redis_exporter --redis.addr=redis://0.0.0.0:6379 --redis.password "your_password_here" --web.listen-address=:9092
and the last logs are
2024-07-26 12:57:46.820
Machine created and started in 22.22s
2024-07-26 12:57:46.809
net.core.somaxconn = 1024
2024-07-26 12:57:46.808
vm.overcommit_memory = 1
2024-07-26 12:57:46.797
2024/07/26 04:57:46 INFO SSH listening listen_address=[fdaa:3:659d:a7b:1d5:617c:a92c:2]:22 dns_server=[fdaa::3]:53
2024-07-26 12:57:46.790
INFO [fly api proxy] listening at /.fly/api
2024-07-26 12:57:46.785
INFO Preparing to run: `docker-entrypoint.sh start-redis-server.sh` as root
2024-07-26 12:57:46.749
INFO Starting init (commit: 3dd5d9e)...
2024-07-26 12:57:46.450
[ 0.279534] PCI: Fatal: No config space access function found
2024-07-26 12:57:46.115
2024-07-26T04:57:46.115071546 [01J3PPD87RRGPVGP938XH5TND7:main] Running Firecracker v1.7.0
2024-07-26 12:57:43.341
[ 681.414363] reboot: Restarting system
2024-07-26 12:57:43.340
WARN could not unmount /rootfs: EINVAL: Invalid argument
2024-07-26 12:57:43.339
INFO Starting clean up.
2024-07-26 12:57:43.326
INFO Main child exited with signal (with signal 'SIGTERM', core dumped? false)
2024-07-26 12:57:42.974
INFO Sending signal SIGTERM to main child process w/ PID 314
2024-07-26 12:57:37.914
INFO Sending signal SIGINT to main child process w/ PID 314
2024-07-26 12:57:37.155
Configuring firecracker
2024-07-26 12:57:36.631
Successfully prepared image registry.fly.io/astring-redis:deployment-01J3PPA20D4Q36N8NTAH3NNVBT (11.96045468s)
2024-07-26 12:57:24.670
Pulling container image registry.fly.io/astring-redis:deployment-01J3PPA20D4Q36N8NTAH3NNVBT