mongoDB ReplicaSet 설정시 couldn’t initiate : can’t find self in the replset config my port 오류

 

mongoDB ReplicaSet 설정시 rs.initiate() 실행시 오류가 발생하며 정상적으로 설정이 진행이 안되는 문제가 있었습니다.

[root@mongo03 cfg]# mongo localhost:31000
MongoDB shell version: 2.4.4-pre-
connecting to: localhost:31000/test
Welcome to the MongoDB shell.
For interactive help, type “help”.
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
> use admin
ㅁswitched to db admin
> rs.initiate()
{
“info2” : “no configuration explicitly specified — making one”,
“me” : “mongo03:31000”,
“ok” : 0,
“errmsg” : “couldn’t initiate : can’t find self in the replset config my port: 31000
}

문제 해결 : 해당 에러가 발생하는 건 mongoDB에서 IP로 해당 서버 DB에 접근하는 것이 아닌 HOSTNAME으로 접근하기때문에 발생한 문제입니다. 에러메세지를 보면 “me”라고 된 부분에 hostname이 표시되어있습니다. 해당 hostname으로 mongoDB에 잘 찾아갈 수 있게 /etc/hosts파일에 해당 hostname을 추가해주면 해결이 가능합니다.

 

 

Server Signature 변경 후에도 적용되지 않는 현상

ModSecurity 설치 후 Server Signature를 변경 후 적용 하였으나, 실제 확인해보면

적용이 제대로 안된 것으로 나오는 현상이 있음.

[증상]

# curl -i localhost
HTTP/1.1 403 Forbidden
Date: Mon, 19 May 2014 05:28:57 GMT
Server: Apache
Content-Length: 202
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don’t have permission to access /
on this server.</p>
</body></html>

 

[해결방법]

apache httpd.conf에 ServerTokens를 Full로 변경 후 아파치 재시작 하면 적용 가능

 

/etc/httpd/httpd.conf

ServerTokens Full

 

설정 변경 후 아파치 재시작. 그리고 다시 테스트

# curl -i localhost
HTTP/1.1 403 Forbidden
Date: Tue, 20 May 2014 00:43:51 GMT
Server: Microsoft-IIS/5.0
Content-Length: 202
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don’t have permission to access /
on this server.</p>
</body></html>