Hi, I am trying to use a local redis for my tests that runs on port 7777.
However I can’t seem to connect to localhost:7777 (connection refused).
Is there something I need to do in order to use a local port?
Preferably not exposing it since that would be a security issue.
Thank you!
How are you installing and starting the local Redis?
Do you mean you are running Redis in a Docker container, and you want to avoid publishing the port? (That is not possible anyway, due to restrictions about how Docker in Docker operates).
Hi halfer, here is the install steps in the Dockerfile of the custom image:
RUN wget http://download.redis.io/redis-stable.tar.gz
RUN tar xzf redis-stable.tar.gz
RUN mv redis-stable redis
RUN cd redis && make
then Redis is started in config.yml with:
- run: /redis/src/redis-server --port 7777 &
I am not using a separate container for Redis.
OK, I would expect that to work. I would try dropping the &
background device to see if it prints any failure messages to the console. Also have a look a Redis logs to see if it is logging a problem and crashing. Finally use networking tools to find out if anything is listening on the port you mention, once Redis started.
Here is the ouput of Redis without the &:
#!/bin/bash -eo pipefail
/redis/src/redis-server --port 7777
52:C 06 Jan 2020 23:08:34.078 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
52:C 06 Jan 2020 23:08:34.078 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=52, just started
52:C 06 Jan 2020 23:08:34.078 # Configuration loaded
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 7777
| `-._ `._ / _.-' | PID: 52
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
52:M 06 Jan 2020 23:08:34.079 # Server initialized
52:M 06 Jan 2020 23:08:34.079 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
52:M 06 Jan 2020 23:08:34.079 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
52:M 06 Jan 2020 23:08:34.079 * Ready to accept connections
It starts fine, then hangs there.
Then I tried to run this:
- run: /redis/src/redis-server --port 7777 > /tmp/redis.log 2>&1 &
- run: sleep 10
- run: ss -tulw
- run: cat /tmp/redis.log
Outputs:
#!/bin/bash -eo pipefail
ss -tulw
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 127.0.0.11:ipproto-57369 *:*
tcp LISTEN 0 128 127.0.0.11:43099 *:*
#!/bin/bash -eo pipefail
cat /tmp/redis.log
There is nothing in the log for some reason.
Is there some restriction on background processes of some sorts?
Alright, good sleuthing so far. Is there a verbose mode on the console so we can see more detail?
No, not as far as I know.
Also, consider a different tack - can you use a Dockerised version of Redis in a secondary CircleCI container? I assume that would work out of the box.
Using this works:
- run:
command: /redis/src/redis-server --port 7777 > /tmp/redis.log 2>&1
background: true
https://circleci.com/docs/2.0/configuration-reference/#background-commands
Using an & doesn’t seem to work in circleci config.
I would definitely appreciate if the doc would state that explicitly.
@halfer thanks for your help!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.