Зеркало 1Win Casino

1 Win Casino Онлайн

The business of life is the acquisition of memories. In the end that’s all there is.

There was a problem:

Today, the Redis service was installed in the local machine (Windows 10) and the virtual machine (Ubuntu 16.04),

  • Windows 10 installation:Redis-x64-3.2.100.msi
  • Ubuntu installation: sudo apt-get install redis-server (The version is: 3.0.6 )

command: redis-server —version

But when testing the remote connection of Redis, I encountered a connection failure error.

problem solved:

Find the reason on the Internet, saying that it is to be in the configuration file bind 127.0.0.1 Comment out. But why do you do this?

The analysis reasons are as follows:

When redis-server is started, if no configuration file is specified, it uses the default configuration file.

When modifying the configuration file, I found bind 127.0.0.1 The comment above the sentence is:

  • in ubuntu /etc/redis/redis.conf :
# By default Redis listens for connections from all the network interfaces # available on the server. It is possible to listen to just one or multiple # 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 
  • In windows redis.windows-service.conf :
# ~~~ 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 lookback interface address (this means Redis will be able to # accept connections only from clients running into the same computer it # is running). # # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES # JUST COMMENT THE FOLLOWING LINE. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bind 127.0.0.1

It’s important to note that here bind Option boundNot the IP of the client requesting the connection , ButThe network interface of the server that provides the redis-server service, Or ratherNetwork card

When configured bind 127.0.0.1 Time meansonly 127.0.0.1 Network interface receives connection request , WhileNot just accept from 127.0.0.1 Request

Remember 127.0.0.1 It is not equal to your local IP, these are two different network interfaces.

related 127.0.0.1 、 IP 、 localhost The relationship between you can moveWhat is the difference between localhost, 127.0.0.1 and the local IP?-Knowing

When the client uses redis-cli -h your_ip_address -p 6379 When the command requests a connection, it should be your_ip_address This network interface is receiving requests, so the following modifications can be made:

  • Directly bind 127.0.0.1 Comment out. At this time, all your network interfaces are receiving connection requests. (include 127.0.0.1 , your_ip_address . (If there are other interfaces, they are also receiving requests)) (The client can connect remotely)
  • will bind 127.0.0.1 change into bind your_ip_address . At this time, only your_ip_address This interface is receiving requests. (Clients can connect remotely, more secure)

Need to restart after modifying the configuration file redis-server : The command is: sudo /etc/init.d/redis-server restart

Carry out the following test verification:

The client in windows requests the Server service in Ubuntu:

  • Start without modification:
C:\Users\14344>redis-cli -h 1**.1**.1**.1** -p 6379 # (Cannot connect all the time, failed)
  • Comment bind 127.0.0.1 :
C:\Users\14344>redis-cli -h 1**.1**.1**.1** -p 6379 1**.1**.1**.1**:6379> keys * (empty list or set) # (connection succeeded)
  • modify bind 127.0.0.1 For bind your_ip_address :
C:\Users\14344>redis-cli -h 1**.1**.1**.1** -p 6379 1**.1**.1**.1**:6379> keys * (empty list or set) # (connection succeeded)

carry on:

Next, modify the configuration file in windows.

  • There are two configuration files in windows (usually redis.windows-service.conf ,If you manually install Redis service, it may be another one):
  • The default configuration file is determined according to the Redis service and can be viewed in the service:
  • In the configuration file bind 127.0.0.1 Comment out and restart the Redis service.

Carry out the following test verification:

  • Request Windows in ubuntu:
bdccl@bdccl-virtual-machine:~$ redis-cli -h 1**.1**.4*.1** -p 6379 1**.1**.4*.1**:6379> keys * Error: Connection reset by peer

Find connection succeeded, butData manipulationAn error has occurred.

Find the reason and find it is necessaryModify the configuration file protected-mode Configuration item

# By default protected mode is enabled. You should disable it only if # you are sure you want clients from other hosts to connect to Redis # even if no authentication is configured, nor a specific set of interfaces # are explicitly listed using the "bind" directive. protected-mode yes

See the notes protected-mode The configuration item is enabled by default yes , Redis is in protected mode and will reject connections from other hosts.

  • Solution: change protected-mode Configuration item is set to no , Pay attentionTo be modified in the configuration file, If passed directly in the client config set protected-mode no Command modification is only valid this time, redis-server After restarting, still yes .

By comparison, it is found that this configuration item does not exist in the Redis configuration file in the Ubuntu system, and the configuration item should be added in a newer version (after version 3.2).

change into no After that, test again, request connection, and data operations can be used normally.

End:

At this point, my windows and Ubuntu can be connected to each other to operate the Redis database.

PS: If your remote connection still has problems, you should check the firewall settings on the server side to see if port 6379 is opened. The operation of firewall is not the focus of this article, readers can solve it by Baidu.

Finally, if there are any errors or shortcomings in this article, please point them out!

Смотрите с 1 Win Casino Онлайн ищут:

  • 1win Игровые Автоматы 1winbookmaker
  • 1 Вин Автоматы
  • 1вин Играть 1win Ijb Xyz
  • Игровые Автоматы 1 Win Альтернативный Адрес
  • 1 Win Игровые Автоматы 1win Plm2
  • 1 Win Игровые Автоматы 1win Vbn Xyz