Connection Refused ...?

Hello!

Trying to set up a new game and running into a ‘Connection Refused’ error; Specifically, the error log reads:

FATAL - Error connecting to database. Check your database configuration: #<Errno::ECONNREFUSED: Can’t connect to: redis:// …

Have checked the database.yml and redis.config to ensure that the url / password matches the port, bind and requirepass in the redis configuration file, and those all appear to match.

Have also attempted the service redis-server status command and have received the following response:

? redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor >
Active: failed (Result: exit-code) since Sun 2022-10-09 19:05:46 UTC; 28mi>

Unfortunately, the tutorials/troubleshooting guides do not give direction as to next steps for an active/failed response; Have attempted game reboot / restart to no luck.

Any assistance or direction would be greatly appreciated. :slight_smile: Will confess to limited code experience, but have successfully installed TinyMU before, so, can navigate the basics.

Thank you much!

Sorry that you’re having trouble getting Ares to run. It appears that the problem is with your redis server. If the DB were running, you would see in that command:

redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-09-25 14:27:46 EDT; 2 weeks 0 days ago

However, your database is not running and thus Ares cannot connect to it.

The first thing I would try is restarting the db using sudo service redis-server restart.

That may give you an error message to help you identify the problem. Or you may need to check the redis error logs using sudo more /var/log/redis/redis-server.log.

I know you already checked the database.yml file but just confirm that it is using the local IP (127.0.0.1) and not the public server IP. This should also be the bind option in your redis.conf file.

Let me know if you’re still having issues after all that, and we’ll see what else we can find.

Thank you for your response and suggestions!

Running the redis-server restart did give a status result of Active: active (running), which is great!

Unfortunately, we’re still having difficulties with the startares command, as the attempted build fails. However, when attempting to connect to the game, a ‘Connection Timed Out’ error is now received instead of ‘Connection Refused’.

At your suggestion, I checked the redis error logs, and found the following as the most recent entries:

14277:M 10 Oct 2022 20:33:35.653 # Server initialized
14277:M 10 Oct 2022 20:33:35.653 # 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.
14277:M 10 Oct 2022 20:33:35.653 # 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.
14277:M 10 Oct 2022 20:33:35.653 * Loading RDB produced by version 6.0.6
14277:M 10 Oct 2022 20:33:35.653 * RDB age 0 seconds
14277:M 10 Oct 2022 20:33:35.653 * RDB memory usage when created 0.84 Mb
14277:M 10 Oct 2022 20:33:35.656 * DB loaded from disk: 0.003 seconds
14277:M 10 Oct 2022 20:33:35.656 * Ready to accept connections

As this is new territory, wanted to check to see if making the changes indicated above is the right direction to take, or if there are additional steps that you would recommend next.

Again, thank you very much for your help and assistance!

Since your redis servier is now active, it’s likely that we’re on to a different problem. Those other warnings will not prevent the game from running.

What exactly is the other time out error you’re receiving? Is it still the game trying to connect to the database?

Good to know about the warnings!

To answer your question; Yes - when attempting to perform ‘startares’, the build fails with the error: ‘Error connecting to database’ showing in the log file. The time out error shows when attempting to connect via a Client program or web browser (not that we are expecting it to be up after the startares fails, but thought the difference in error might be useful).

Thank you again, and please advise as to next steps or any additional information needed. We very much appreciate your help in this.

Make sure that the game isn’t already running before you try bin/startares. You can do this by running: ps -aux | grep rake from the server shell. If the game is running, you will see a line like this:

ares 1879 0.0 14.1 1291912 286552 ? Sl Sep25 1:47 ruby /home/ares/.rvm/gems/ruby-2.6.3/bin/rake startares[]
If you do, stop that game instance before trying to restart it again. Use the process ID from the second column above like so: kill -9 1879.

Once you’re sure the game isn’t running, you can try is bringing the game up in debug mode. To do that, you just use bin/devstart instead of bin/startares. Sometimes when there are startup errors, you will get more information this way. The game will only stay up as long as you leave it running in the shell, though. When you log out or CTRL-C to quit the app, it will stop.

It can’t hurt to double-check the connection info in database.yml and secrets.yml

I suppose it could be firewall related if you’ve modified those settings at all, but that shouldn’t be an issue with the default configuration.

It can often be helpful to get some ‘live’ troubleshooting in the discord server. If you aren’t already a member, just PM me here for an invite.