2. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
設立
• 2006年1月
BP含めて130人ぐらい
事業概要
• クラウドインテグレーション事業
• IoTビックデータソリューション事業
• DevOps関連サービス事業
クリエーションラインのホームページ
• https://www.creationline.com
クリエーションライン株式会社
2
3. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
自己紹介
李 昌桓 (LEE CHANGHWAN,@awk256)
データベースが大好きなサーバサイドのエンジニア。NoSQLを中核としたビックデータ処理基盤のアーキテクトとして活動
しています。
クリエーションライン www.creationline.com
Neo4jユーザーグループ jp-neo4j-usersgroup.connpass.com
[ブログ] [著書]グラフデータベースNeo4jの他
www.creationline.com/lab/neo4j
www.qiita.com/aw256
www.amazon.co.jp/李昌桓/e/B004LWEKOU 3
4. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
はじめに
本スライドでは、MongoDB Atlasのアカウント取得方法を簡略に紹介しています。
MongoDB Atlasとは
MongoDBのクラウドサービスであり、アプリケーション開発プラットフォームです。
Atlas Account持っていない方は
今なら、永久無料のクラスター付きでアカウントが取得できます。クレジットカード番号は要りません。
4
5. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
MongoDB Account取得
https://www.mongodb.com/cloud/atlas
5
MongoDB Atlasのトップべージに移動しましょう。
簡単にアカウントを取得し、無料枠のクラスターを体験できます。
6. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
アカウント情報登録(Get Start Free)
6
アカウント情報を登録して下さい。
このページを送信したら、即時アカウント登録は完了します。
途中でリンクが切れたりした場合は、直接ログインして下さい。
https://cloud.mongodb.com/user#/atlas/login
7. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
無料クラスター作成(Create New Cluster)1/2
7
Wellcomeページなどはスキップして下さい。
この画面が見えない場合、トップページに戻っ
てからクラスター作成を開始して下さい[Click
Build a Cluster]
さらに、画面を下にスクロールしてみて下さい。
8. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
無料クラスター作成(Create New Cluster)2/2
8
それぞれのメニューブロックを開いてみて下さい。
M0 Sandboxタイプのインスタンスのみが
無料です。
すべて、Defaultの状態で結構です。
クラスター作成を開始して下さい[Click
Create Cluster]
請求が来ることは絶対ありません!
9. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
クラスター作成終了[ATLAS>Clusters]
9
クラスター作成を開始してからしばらく待つと、
M0インスタンス3台のクラスターが上がります。
10. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
データベースのユーザ登録[SECURITY>Database Access]
10
データベースに接続するためのユーザを作成しましょう。
11. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
ホワイトリスト登録[SECURITY>Network Access]
11
ホワイトリストは、接続元を制限するファイアウォールです。
接続元のIPアドレスを登録して下さい[Click ADD CRRENT IP ADDRESS]
又は、CIDRブロック(xxx.xxx.xxx.xxx/xx)を指定して下さい。
12. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
Mongo Shellのコネクッション文字列の取得[CONNECT>Connect with the Mongo Shell]
12
クライアントツールを持っていない場合は、インストールして下さい。
接続文字列を控えておきましょう。
13. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
接続文字列の編集
【変更前】
mongo "mongodb+srv://cluster0-xxxxx.mongodb.net/test" --username <username>
【変更後】
mongo "mongodb+srv://cluster0-xxxxx.mongodb.net/test" --username admin --
authenticationDatabase="admin"
13
14. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
MongoDB Clusterへ接続
C:¥Works¥mongodb-cli¥atlas¥mongodb-shell-win32-x86_64-2008plus-ssl-4.0.10¥bin>mongo "mongodb+srv://cluster0-xxxxx.mongodb.net/test" --username admin --
authenticationDatabase="admin"
MongoDB shell version v4.0.10
Enter password:
connecting to: mongodb://cluster0-shard-00-02-xxxxx.mongodb.net.:27017,cluster0-shard-00-01-xxxxx.mongodb.net.:27017,cluster0-shard-00-00-
xxxxx.mongodb.net.:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true
2019-09-26T16:39:31.611+0900 I NETWORK [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-02-xxxxx.mongodb.net.:27017,cluster0-shard-00-01-
xxxxx.mongodb.net.:27017,cluster0-shard-00-00-xxxxx.mongodb.net.:27017
2019-09-26T16:39:32.580+0900 I NETWORK [js] Successfully connected to cluster0-shard-00-01-xxxxx.mongodb.net.:27017 (1 connections now open to cluster0-shard-00-01-
xxxxx.mongodb.net.:27017 with a 5 second timeout)
2019-09-26T16:39:32.621+0900 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-00-xxxxx.mongodb.net.:27017 (1 connections now open to
cluster0-shard-00-00-xxxxx.mongodb.net.:27017 with a 5 second timeout)
2019-09-26T16:39:32.759+0900 I NETWORK [js] changing hosts to Cluster0-shard-0/cluster0-shard-00-00-xxxxx.mongodb.net:27017,cluster0-shard-00-01-
xxxxx.mongodb.net:27017,cluster0-shard-00-02-xxxxx.mongodb.net:27017 from Cluster0-shard-0/cluster0-shard-00-00-xxxxx.mongodb.net.:27017,cluster0-shard-00-01-
xxxxx.mongodb.net.:27017,cluster0-shard-00-02-xxxxx.mongodb.net.:27017
2019-09-26T16:39:33.514+0900 I NETWORK [js] Successfully connected to cluster0-shard-00-00-xxxxx.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00-
xxxxx.mongodb.net:27017 with a 5 second timeout)
2019-09-26T16:39:33.604+0900 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-01-xxxxx.mongodb.net:27017 (1 connections now open to cluster0-
shard-00-01-xxxxx.mongodb.net:27017 with a 5 second timeout)
2019-09-26T16:39:34.563+0900 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to cluster0-shard-00-02-xxxxx.mongodb.net:27017 (1 connections now open to cluster0-
shard-00-02-xxxxx.mongodb.net:27017 with a 5 second timeout)
2019-09-26T16:39:35.090+0900 I NETWORK [js] Successfully connected to cluster0-shard-00-00-xxxxx.mongodb.net:27017 (1 connections now open to cluster0-shard-00-00-
xxxxx.mongodb.net:27017 with a 0 second timeout)
Implicit session: session { "id" : UUID("f93999de-2ed2-43d2-8630-bf226b317129") }
MongoDB server version: 4.0.12
MongoDB Enterprise Cluster0-shard-0:PRIMARY>
14
ここでは、Windows用のクライアントツール(mongo)でリモート接続しています。
15. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved
helpコマンド
MongoDB Enterprise Cluster0-shard-0:PRIMARY> help
db.help() help on db methods
db.mycoll.help() help on collection methods
sh.help() sharding helpers
rs.help() replica set helpers
help admin administrative help
help connect connecting to a db help
help keys key shortcuts
help misc misc things to know
help mr mapreduce
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
show logs show the accessible logger names
show log [name] prints out the last segment of log in memory, 'global' is default
use <db_name> set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
15
Mongo Shellで実行できるコマンド一覧が
表示されるはずです。
16. Copyright ⓒ2019 CREATIONLINE, INC. All Rights Reserved 16
以上、有難うございました。
不明点、MongoDBの導入に関する問い合わせは
https://www.creationline.com/contact
までにお願い致します。