Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED

后端 未结 17 1970
时光说笑
时光说笑 2020-12-12 15:34

I working with node.js by expressjs
I try to store an account to session. So, i try to test to use session with code in expressjs

var RedisStore = requ         


        
相关标签:
17条回答
  • 2020-12-12 15:46

    I'm on MBP , and install redis detail my problem was resolved .Fixed the Download, extract and compile Redis with:

    $ wget http://download.redis.io/releases/redis-3.0.2.tar.gz
    
    $ tar xzf redis-3.0.2.tar.gz
    
    $ cd redis-3.0.2
    
    $ make
    

    The binaries that are now compiled are available in the src directory.

    Run Redis with:

    $ src/redis-server 
    
    0 讨论(0)
  • 2020-12-12 15:49

    Simple solution:

    only hit below commend once and restart your server again

    redis-server
    
    0 讨论(0)
  • 2020-12-12 15:49

    For me I had this issue on Ubuntu 18.x, but my problem was that my redis-server was running on 127.0.0.1 but I found out I needed to run it on my IP address xxx.xx.xx.xx

    I went into my Ubuntu machine and did the following.

    cd /etc/redis/

    sudo vim redis.conf

    Then I edited this part.

    ################################## NETWORK #####################################
    
    # By default, if no "bind" configuration directive is specified, Redis listens
    # for connections from all the network interfaces available on the server.
    # It is possible to listen to just one or multiple selected interfaces using
    # the "bind" configuration directive, followed by one or more IP addresses.
    #
    # Examples:
    #
    # bind 192.168.1.100 10.0.0.1
    # bind 127.0.0.1 ::1
    #
    # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
    # internet, binding to all the interfaces is dangerous and will expose the
    # instance to everybody on the internet. So by default we uncomment the
    # following bind directive, that will force Redis to listen only into
    # the IPv4 loopback interface address (this means Redis will be able to
    # accept connections only from clients running into the same computer it
    # is running).le to listen to just one or multiple selected interfaces using
    #
    # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
    # JUST COMMENT THE FOLLOWING LINE.
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # bind 127.0.0.1 ::1 10.0.0.1
    bind 127.0.0.1 ::1 # <<-------- change this to what your iP address is something like (bind 192.168.2.2)
    
    

    Save that, and then restart redis-server.

    sudo service redis-server restart or simply run redis-server

    0 讨论(0)
  • 2020-12-12 15:52

    Your connection to redis is failing. Try restarting your redis server, then starting up your client again by running these 3 commands:

    sudo service redis-server restart
    redis-server
    redis-cli
    
    0 讨论(0)
  • 2020-12-12 15:52

    I think maybe you installed redis by source code.If that you need locate to redis-source-code-path/utils and run sudo install_server.sh command. After that, make sure redis-server has been running as a service for your system sudo service redis-server status

    PS: based on Debian/Ubuntu

    0 讨论(0)
  • 2020-12-12 15:54

    After you install redis, type from terminal:

    redis-server
    

    and you'll have redis running

    0 讨论(0)
提交回复
热议问题