RedisDesktopManager接続リモートRedis詳細教程

6185 ワード

環境の準備
Linux  :CentOS 7.3.        
Redis     :3.2.6  
Redis       :https://redisdesktop.com/download  
Redis  、      :http://www.runoob.com/redis/redis-install.html 【 Win、Linux、Mac、Ubuntu】
リモート接続
1.設置時に発生する問題
      1:make[3]: gcc: Command not found  
      : Centos    yum install gcc;
          Ubuntu    apt-get install gcc;

      2:zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory 
          zmalloc.h:55:2: error: #error “Newer version of jemalloc required” 
          make[1]: * [adlist.o] Error 1 
      :  make MALLOC=libc,      
2.インストールが完了したら、redisインストールディレクトリに入って実行します。
    [root@Karle src]# ./redis-server 
    2745:C 10 Sep 10:16:13.130 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
    2745:M 10 Sep 10:16:13.131 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                    _._                                                  
               _.-``__ ''-._                                             
          _.-``    `.  `_.  ''-._           Redis 3.2.6 (00000000/0) 64 bit
      .-`` .-```.  ```\/    _.,_ ''-._                                   
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 2745
      `-._    `-._  `-./  _.-'    _.-'                                   
     |`-._`-._    `-.__.-'    _.-'_.-'|                                  
     |    `-._`-._        _.-'_.-'    |           http://redis.io        
      `-._    `-._`-.__.-'_.-'    _.-'                                   
     |`-._`-._    `-.__.-'    _.-'_.-'|                                  
     |    `-._`-._        _.-'_.-'    |                                  
      `-._    `-._`-.__.-'_.-'    _.-'                                   
          `-._    `-.__.-'    _.-'                                       
              `-._        _.-'                                           
                  `-.__.-'                                               

    2745:M 10 Sep 10:16:13.145 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
    2745:M 10 Sep 10:16:13.145 # Server started, Redis version 3.2.6
    2745:M 10 Sep 10:16:13.147 # 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.
    2745:M 10 Sep 10:16:13.147 # 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.
    2745:M 10 Sep 10:16:13.147 * DB loaded from disk: 0.000 seconds
    2745:M 10 Sep 10:16:13.147 * The server is now ready to accept connections on port 6379
3.Redisサービスはすでに成功的に起動できました。インターフェースはRedisサービスウィンドウに留まり続けています。Ctrl+Cを押すと、サービスウィンドウをブロックできますが、同時にRedisサービスを終了します。
4.Redisサービスはデフォルトではフロントで実行され、バックグラウンドで実行するように変更する必要があります。前の階層のディレクトリに戻り、redis.com nfプロファイルを変更します。daemonize(デーモンプロセス)の設定を見つけました。
        daemonize no

        daemonize yes
5.サービスを開始しながら最新のプロファイルを読み込む
    [root@Karle src]# ./redis-server ../redis.conf
6.RedisDesktopManagerクライアントを使用して、サーバのIPアドレス、ポートを入力し、テストをクリックします。
成功ですか?over!——————失敗して続きを見る。
7.Redisはデフォルトではローカルリンクのみをサポートし、デフォルトの設定を変更します。
    [root@Karle src]# ps -ef | grep redis 
    root 5239 1 0 10:37 ? 00:00:00 ./redis-server 127.0.0.1:6379 
    root 5244 2321 0 10:37 pts/0 00:00:00 grep redis

        :  redis.conf    ;   61         80      no
    56 # bind 127.0.0.1 
    70 protected-mode no

               ,  Redis    ,  127.0.0.1:6379

    [root@Karle src]# ./redis-server ../redis.conf 
    [root@Karle src]# ps -ef | grep redis 
    root 5352 1 0 10:59 ? 00:00:00 ./redis-server 127.0.0.1:6379 
    root 5367 2321 0 11:00 pts/0 00:00:00 grep redis

      Redis  ,            

    [root@Karle src]# redis-cli shutdown 
    [root@Karle src]# ./redis-server ../redis.conf

           :

    [root@Karle src]# ps -ef | grep redis 
    root 5391 1 0 11:05 ? 00:00:00 ./redis-server *:6379 
    root 5395 2321 0 11:05 pts/0 00:00:00 grep redis


成功ですか?over!——————失敗して続きを見る。
8.ファイアウォールの設置
    [root@Karle src]# service iptables status
      :filter
    Chain INPUT (policy ACCEPT)
    num  target     prot opt source               destination         
    1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
    3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
    4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
    5    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:8080 
    6    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80 
    7    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:3306 
    8    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:15672  
    9   REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

      Linux    
    [root@Karle src]# vi /etc/sysconfig/iptables 
           :-A INPUT -m state –state NEW -m tcp -p tcp –dport 6379 -j ACCEPT

      Linux    
    [root@Karle src]# service iptables restart

      Test Connection      ,    !!!

    ![   ](https://i.imgur.com/jv9CHnS.png)