MongoDB University 12/19 데이터 세트 가져오기
현재 진행 중인 노선: M103[1].목표는 12/25 이전에 Chapter 1 완성!
Chapter 1: Lab: Importinga Dataset(연습 문제)
Problem:
Import a dataset into MongoDB using mongoimport:
Mongoimport을 사용하여 MongoDB로 데이터 가져오기
시험해 보다
storage:
dbPath: /var/mongodb/db
net:
bindIp: localhost
port: 27000
security:
authorization: enabled
systemLog:
destination: file
path: /var/mongodb/logs/mongod.log
logAppend: true
processManagement:
fork: true
부팅 확인시동이 걸렸어요.
bash-4.4# ps -elf | grep mongod
159 root 0:01 mongod --port 27000 --dbpath /var/mongodb/db --auth --logpath /var/mongodb/logs/mongod.log --logappend --fork
383 root 0:00 grep mongod
접속 확인bash-4.4# mongo --port 27000 -u m103-application-user -p m103-application-pass
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27000/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("80d7435d-91f1-4725-a0d8-5fc4060a29a2") }
MongoDB server version: 4.0.5
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
> show databases;
>
> use applicationData
switched to db applicationData
계좌가 이미 존재하는 것 같습니다.가져오기 시도
데이터 파일을 확인합니다.는 json 파일(텍스트)입니다.
bash-4.4# head /dataset/products.json
{"_id":{"$oid":"573f7197f29313caab89b21b"},"sku":20000008,"name":"Come Into The World - CD","type":"Music","regularPrice":14.99,"salePrice":14.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b21c"},"sku":20000017,"name":"Paragon of Animals - CD","type":"Music","regularPrice":14.99,"salePrice":14.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b21d"},"sku":20000035,"name":"Hedgehog's Dilemma - CD","type":"Music","regularPrice":14.99,"salePrice":14.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b21e"},"sku":20000026,"name":"Very Best of the Foundations [Pony Canyon] - CD","type":"Music","regularPrice":13.99,"salePrice":13.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b21f"},"sku":20000053,"name":"Frontline of K-Pop - CD","type":"Music","regularPrice":22.99,"salePrice":22.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b220"},"sku":20000044,"name":"Prototpye A [EP] - CD","type":"Music","regularPrice":8.99,"salePrice":8.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b222"},"sku":20000062,"name":"New Year's Day [Single] - CD","type":"Music","regularPrice":20.99,"salePrice":20.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b223"},"sku":20000071,"name":"What a Circus - CD","type":"Music","regularPrice":17.99,"salePrice":17.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b224"},"sku":20000099,"name":"Summer Ends - CD","type":"Music","regularPrice":11.99,"salePrice":11.99,"shippingWeight":"0.25"}
{"_id":{"$oid":"573f7197f29313caab89b225"},"sku":20000105,"name":"Dance Dance Revolution - CD","type":"Music","regularPrice":11.99,"salePrice":11.99,"shippingWeight":"0.25"}
가져오기 옵션 확인bash-4.4# mongoimport --help
Usage:
mongoimport <options> <file>
Import CSV, TSV or JSON data into MongoDB. If no file is provided, mongoimport reads from stdin.
See http://docs.mongodb.org/manual/reference/program/mongoimport/ for more information.
https://docs.mongodb.com/database-tools/mongoimport/(새 버전용)
mongoimport --port 27000 -u m103-application-user -p m103-application-pass \
--authenticationDatabase admin \
--db applicationData --collection products \
--file /dataset/products.json
2020-12-19T12:33:31.575+0000 connected to: mongodb://localhost:27000/
2020-12-19T12:33:31.970+0000 9966 document(s) imported successfully. 0 document(s) failed to import.
잘 되고 있나 봐요.테스트 실행 시 확인!
오늘의 진전
Chapter 1 완성!
다음이 드디어 발표된다.웹의 IDE에서는 도대체 어떻게 훈련을 진행합니까?
그리고 다음은 30step...
목표는 열흘 뒤, 29일쯤이죠.
오늘의 젠.
계속해서 같은 방법으로 진행되고 있다.
각주
M103: Basic Cluster Administration세트.수업을 시작하면 이수까지의 기한은 두 달 이내이다.↩︎
Reference
이 문제에 관하여(MongoDB University 12/19 데이터 세트 가져오기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/akiko_pusu/articles/20201219-mongodb-univ텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)