技術ネタはQiitaに移りました。壁もどこぞに。

Redis リモートアクセスと GUI クライアント

Redis のセットアップ自体は
以下記事のとおり早々に済ませていたものの、

CentOS7 セットアップ Redis - 作業ノート

設定関連については一切していなかったので
いざリモートホストから使おうとしても、
まだ接続ができない状態になっている。
そこで今回は、リモートホストから接続できるように設定を変更する。

/etc/redis.conf の64行目付近。
"bind" で検索してヒットした付近を変更する。
念のためファイルのバックアップをとってから。

sudo cp /etc/redis.conf /etc/redis.conf.0
sudo vi /etc/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

最後の "bind 127.0.0.1" に続いて、半角スペース区切りで
接続を許可する IP を追記する。

任意の IP アドレスからの接続を許可する場合は、
"0.0.0.0" を設定する。

# 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 0.0.0.0

これでリモートホストからの接続ができるようになった。
確認を毎度コマンドでやるのも面倒かつ、可視性に欠けるので、
今回は GUI クライアント経由で接続を確認してみる。

Redis Desktop Manager というのが無償で使えて良さげ。
Redis Desktop Manager - Redis GUI management tool for Windows, Mac OS X, Ubuntu and Debian.

インストールしたら、接続を追加する。
サイドメニュー下部の[Add New Connection]から。

f:id:Yoichi-KIKUCHI:20150103001215p:plain

[Name]は任意の接続名。
[Host:]は接続先ホスト名、または IP アドレス。
[Port:]は接続ポート。デフォルト "6379"。

f:id:Yoichi-KIKUCHI:20150103001305p:plain

これで接続が確認できた。

f:id:Yoichi-KIKUCHI:20150103001851p:plain