Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection refused [tcp://127.0.0.1:6379] #21

Open
durino13 opened this issue Jan 28, 2020 · 1 comment
Open

Connection refused [tcp://127.0.0.1:6379] #21

durino13 opened this issue Jan 28, 2020 · 1 comment

Comments

@durino13
Copy link

I am trying to use socket.io in my project. Everything works locally ;) My browser establishes a connection with the node server and once I emit the event, I see it in the browser.

When I deploy the application on the server, I get following error:
Connection refused [tcp://127.0.0.1:6379]
It looks like some kind of process can't connect to the redis service running on this port. The sysadmin running the told me, that the service is running on that port (he event sent me some 'netstat') output, which proved that.

I have tried to use the 'predis' library and I wrote a piece of PHP code, which was able to connect to the service and the port:
` public function actionTest()
{
\Predis\Autoloader::register();

    try {
        $redis = new \Predis\Client();

        // This connection is for a remote server
        $redis = new \Predis\Client(array(
            "scheme" => "tcp",
            "host" => "localhost",
            "port" => 6379
        ));
        echo 'Connection successful';
    } catch (Exception $e) {
        die($e->getMessage());
    }
}`

When I execute this on the server, I get a 'connection successfull' message. I run these commands in order to start the socketio services:
php yii socketio/php-server and php yii socketio/node-js-server .. I think socket should be OK, because I can see the connection in the browser developer tools (WS tab) and there are no errors in the console.

Any idea what could be the problem? I am lost ;(

@ArtMin96
Copy link

I dont think you have installed a redis server yet ;)

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants