준비단계
CouchDB 설치 후 설정변경을 위해서는 설정파일을 찾아 목적에 맞게 수정할 필요할 수 있다.
Ubuntu에 설치된 couchdb의 경우 다음의 순서로 설정파일을 읽는다.
- etc/default.ini
- etc/default.d/*.ini
- etc/local.ini
- etc/local.d/*.ini
설정파일 위치는 설치(install)시 어떤 위치에 했는냐에 따라 다르다.
설치 위치를 모르겠다면 검색 명령어로 찾아서 확인할 수 있다. (ex, dpkg -L couchdb)
필자의 경우 설정파일 위치와 실행파일위치는 아래와 같다.
[설정파일 위치]
- path : /opt/couchdb/etc/
- 파일 : default.ini, local.ini
[실행파일 위치]
- path : /etc/init.d
- 파일 : ./couchdb {start|stop|restart|status}
ssl 설정
couchdb 버전에 상관없이 설정방법은 비슷하다.
현재 예시는 couchdb2.1 기준이며, 해당 설명 링크는 다음과 같다.
ssl 설정안내 : http://docs.couchdb.org/en/stable/config/http.html#secure-socket-level-options
ssl 설정과정
- 인증서 생성
mkdir cert && cd cert openssl genrsa -out localhost.key 2048 openssl req -new -x509 -key localhost.key -out localhost.crt -days 3650 -subj /CN=localhost
- local.ini 설정 변경
[daemons] httpsd = {couch_httpd, start_link, [https]} [ssl] cert_file = /opt/couchdb/etc/cert/localhost.crt key_file = /opt/couchdb/etc/cert/localhost.key
- 테스트
curl -k https://localhost:6984
성공했다면 아래와 같은 메시지를 확인 할 수 있다.
curl -k https://localhost:6984 {"couchdb":"Welcome","version":"2.1.0","features":["scheduler"],"vendor":{"name":"The Apache Software Foundation"}}