본문 바로가기

728x90

MongoDB

[리눅스] PHP 확장 모듈(extension module) 설치 - MongoDB PHP Driver PHP 확장 모듈(extension module) 설치 - MongoDB PHP Driver PECL 모듈 다운로드 : https://pecl.php.net/package/mongodb 소스 컴파일 패키지 다운로드 wget https://pecl.php.net/get/mongodb-1.13.0.tgz tar xfz mongodb-1.13.0.tgz cd mongodb-1.13.0 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make -j$(nproc) && make install -j$(nproc) /usr/local/php/bin/php -i | grep "Loaded Configuration .. 더보기
[리눅스] mongodb, mongo-express 도커 컨테이너 올리기 mongodb, mongo-express 도커 컨테이너 올리기 docker-compose.yml 편집 version: '3.9' services: ### Mongodb Servers mongo1: image: anti1346/mongo:5.0.8 container_name: mongo1 restart: unless-stopped env_file: - .env environment: - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME} - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD} - TZ=Asia/Seoul command: mongod --auth --replSet rs1 --keyFile /d.. 더보기
[리눅스] mongodb secondary show dbs 에러 mongodb secondary show dbs 에러 show dbs; rs3:SECONDARY> show dbs; uncaught exception: Error: listDatabases failed:{ "topologyVersion" : { "processId" : ObjectId("62a024b73a8739206de930ae"), "counter" : NumberLong(6) }, "ok" : 0, "errmsg" : "not master and slaveOk=false", "code" : 13435, "codeName" : "NotPrimaryNoSecondaryOk" } : _getErrorWithCode@src/mongo/shell/utils.js:25:13 Mongo.prototype.get.. 더보기
[리눅스] mongodb 서버 환경 설정 mongodb 서버 환경 설정 테스트 환경 cat /etc/os-release $ cat /etc/os-release NAME="Ubuntu" VERSION="20.04.3 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.3 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-pol.. 더보기
[리눅스] mongodb(router) - 3 mongodb(router) - 3 docker run -it --rm --add-host=mongodb-201:1.1.1.201 --add-host=mongodb-202:1.1.1.202 --add-host=mongodb-203:1.1.1.203 anti1346/mongo:5.0.8 bash mongo mongodb-201:27017 # mongo mongodb-201:27017 MongoDB shell version v5.0.8 connecting to: mongodb://mongodb-201:27017/test?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("526dd9c5-f3e0-4baf.. 더보기
[리눅스] mongodb(shard) - 2 mongodb(shard) - 2 mongodb PRIMARY docker-compose exec mongo1 bash mongo --port 27011 rs.initiate( { _id: "rs0", members: [ { _id: 0, host : "mongodb-201:27011" }, { _id: 1, host : "mongodb-202:27011" }, { _id: 2, host : "mongodb-203:27011" }, { _id: 3, host : "mongodb-201:27012" }, { _id: 4, host : "mongodb-202:27012" }, { _id: 5, host : "mongodb-203:27012" }, { _id: 6, host : "mongodb-203:2701.. 더보기
[리눅스] mongodb(config) - 1 mongodb(config) - 1 mongodb PRIMARY docker-compose exec config bash mongo --port 27018 ReplicaSet 초기화 rs.initiate( { _id: "configserver", members: [ { _id: 0, host : "mongodb-201:27018" }, { _id: 1, host : "mongodb-202:27018" }, { _id: 2, host : "mongodb-203:27018" } ] } ) use admin configserver:PRIMARY> use admin switched to db admin db.createUser({user:"root",pwd:"changeme",roles:[{role:"root".. 더보기
[리눅스] PHP 7.X 버전에서 몽고DB 연동 PHP 7.X 버전에서 몽고DB 연동(확장 프로그램 설치) $ git clone https://github.com/mongodb/mongo-php-driver.git $ cd mongo-php-driver/ $ git submodule update --init $ /usr/local/php/bin/phpize $ ./configure --with-php-config=/usr/local/php/bin/php-config $ make all $ make install --output-- PATH="$PATH:/sbin" ldconfig -n /usr/local/src/mongo-php-driver/modules ------------------------------------------------------.. 더보기

728x90