[NoSQL] MongoDB CentOS 설치, 실행, Studio 3T, MongoDB Compass Community

MongoDB CentOS 설치, 실행, Studio 3T 원격 접속
MongoDB install
$ vi /etc/yum.repos.d/mongodb-org-3.6.repo // yum 저장소 신규 설정
[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
gpgcheck=1 
enabled=1 
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc

# 아래와 같이 키 관련 오류가 발생 되면 잠시 /etc/yum.repos.d/mongodb-org-3.6.repo에서 'gpgcheck=1 '→'gpgcheck=0 '

GPG key retrieval failed: [Errno 14] curl#35 - "Cannot communicate securely with peer: no commogorithm(s)."

# sudo yum install -y mongodb-org              // yum을 통한 mongoDB 설치
# vi /etc/yum.conf                                         // yum 자동 업데이트시 mongoDB 제외
exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools


// 확인 명령어들
# service mongod status                                          // 서비스 상태 확인
# service mongod start                                            // 서비스 시작, … stop 서비스 종료
# mongo --version                                                   // 버전 확인

// 실행시 아래와 같은 보안 경고가 생길 경우
Server has startup warnings:
2018-08-28T18:23:50.985+0900 I STORAGE  [initandlisten]
2018-08-28T18:23:50.985+0900 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-08-28T18:23:50.985+0900 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten]
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten]
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten]
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten]
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-08-28T18:23:51.590+0900 I CONTROL  [initandlisten]
# vi /etc/mongod.conf                      // 설정 파일 수정(보안을 위해 포트도 변경)
#network interfaces
net:
  port: 2701
  bindIp: 0.0.0.0
  #bindIp: 127.0.0.1,117.52.89.108,10.11.168.19
security:
  authorization: enabled

// 백업, 복원(ver 3.2 이상)
# mongodump --archive --db test --port 2701
# mongorestore --archive --port 2702


// 관리자 계정을 먼저 생성하고 사용자계정 생성 데이터베이스 생성 순으로 진행
# mongod --port 2701 --dbpath /data/db1 // 포트, 데이터 저장 경로 설정
# mongo --port 2701 // 접속
> use admin
> db.createUser( {user: "Admin", pwd: "abc123", roles: [ { role: "Admindb", db: "admin" } ]  }). // 어드민 생성
> exit
# sudo service mongod restart
# mongod --auth --port 2701 --dbpath /data/mongodata  // 디렉토리 생성 후 포트, 저장 경로 지정
# mongo --port 2701 -u "Admin" -p "abc123" --authenticationDatabase "admin”. // 관리자 접속
# mongo --port 2701
> use test
> db.createUser( {user: "jaurim", pwd: "xyz123", roles: [ { role: "readWrite", db: "jaurimdb" },  { role: "read", db: "reporting" } ]  }).  // 사용자 계정 생성
> exit
# mongo --port 2701 -u "jaurim" -p "xyz123" --authenticationDatabase "jaurimdb”.  // 사용자로 접속
> jaurimdb.foo.insert( { x: 1, y: 1 } ) // 데이터 삽입



MongoDB Compass Community
  • 다운
    • Version에서 'Community Edtion Stable'을 선택하여 다운
    • Cloud, Servers, Tools에서 'Tools'-> 'Compass' 선택
      • AWS, GCP, Azure는 'Cloud'
      • MongoDB Enterprise comes는 'Servers' 선택

  • 접속
    • Hostname, Port, Username, Password, Auth... Database 등 선택 후 접속


Studio 3T. (30일 사용 후 유료 전환)
  1. Studio 3T 설치 후 실행 하고 'Connect' → 'New Connect' 

  1. Server 탭에서 호스트정보와 포트 정보 입력

  1. Authentication 탭에서 Authentication Mode에서 Basic ... 리스트 클릭
  2. User Name, Password,  Authentication DB(= RDBMS Database Name) 입력

댓글

  1. After looking through a few blog articles on your website,we sincerely appreciate the way you blogged.We’ve added it to our list of bookmarked web pages and will be checking back in the nearfuture. Please also visit my website and tell us what you think.Great work with hard work you have done I appreciate your work thanks for sharing it.
    Studio 3T Crack

    답글삭제

댓글 쓰기

이 블로그의 인기 게시물

[유니티] 오류 사례 "Moving file failed", "Temp"

[유니티 사례] 비주얼 스튜디오(Visual Studio) 실행 오류

[유니티] 구글 지도 출력 샘플