resolv.confにnameserverを設定しても「Name or service not known」になる
参照順によっては正しいnameserverであっても意図して機能しないケースがあるので注意
例)nameserver xxx.xxx.254.134を参照すればweb1でsshできるはずができなかった
vim /etc/resolv.conf
nameserver xxx.xxx.0.12
nameserver xxx.xxx.254.134
search xxx.xxx.local
$ ssh web1
ssh: Could not resolve hostname web1: Name or service not known
最初のnameserverをコメントアウトしたら接続できるようになった
#nameserver xxx.xxx.0.12
nameserver xxx.xxx.254.134
search xxx.xxx.local
あるいは先に持ってくる
nameserver xxx.xxx.254.134
nameserver xxx.xxx.0.12
search xxx.xxx.local
$ ssh web1
user@web1's password:
Last login: Tue Dec 10 17:04:34 2013 from xxx.xxx.xxx.xxx
ちなみに、resolv.confの変更に対してnetworkのrestartなどは必要ありませんでした
telnetでkeep-aliveの確認
KeepAlive On ←keep-aliveを有効にする
MaxKeepAliveRequests 100 ←100リクエストまで連続で受け付ける
KeepAliveTimeout 10 ←次のリクエストがくるまで10秒間コネクションを継続する
$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1 ←入力
Host: localhost ←入力 ※:がないと400 Bad Requestになるので注意
←ここでEnter
HTTP/1.1 200 OK
Date: Fri, 29 Nov 2013 12:00:49 GMT
Server: Apache
X-Powered-By: PHP/5.4.14
Content-Length: 19
Content-Type: text/html(コンテンツが表示されます)
(keep-aliveが有効だとしばらくこのまま待ち状態。続けてリクエスト入力できる)
Connection closed by foreign host. ←KeepAliveTimeoutの秒数が経過すると表示されcloseします。あるいはMaxKeepAliveRequestsの数だけ繰り返しリクエストしても終了します
HTTP/1.0ではkeep-aliveが対応していないので、KeepAlive=Onであっても直ちにcloseする
$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0 ←1.0に変更
←ここでEnter ※HTTP/1.0ではHost: は必須ではない
HTTP/1.1 200 OK
Date: Fri, 29 Nov 2013 12:14:47 GMT
Server: Apache
X-Powered-By: PHP/5.4.14
Content-Length: 19
Connection: close
Content-Type: text/html(コンテンツが表示)
Connection closed by foreign host.
memcachedのデータを移行する
別ネットワークへのサーバ移行などの場合は、ファイル出力するなどで対応
既存サーバにて、データをダンプ
# memcached-tool localhost:11211 dump > 11211.dump
移行先サーバにてリストア
一旦restartしてmemcacheを空にする
# service memcached.11211 restart Shutting down Distributed memory caching (memcached.11211):[ OK ] Starting Distributed memory caching (memcached.11211): [ OK ]
受取ったdumpデータを流し込みます
# cat 11211.dump | nc localhost 11211 STORED
STORED と出れば成功
リストア時に既にデータが入っていると NOT_STORED となり、保存できません。restartで空にしておきます
# cat 11211.dump | nc localhost 11211 NOT_STORED
2つのファイルを比較して共通な行を表示しない
file1とfile2を比較し、共通な部分は非表示としたリストを表示したい
sdiff -s file1 file2 | cut -f 1
例)
$ cat file1
408
123$ cat file2
408
11002517
11003638$ sdiff -s file1 file2 | cut -f 1
11002517
11003638#ファイルに書き出したい場合
$ sdiff -s file1 file2 | cut -f 1 > file3
外部キーやユニークキーなどが貼られているか確認
show create table