>[Memo]MongoDB 64bit Win7-OS
2011/02/10
投稿者: : >昨日の問題点1. 2Gを超えるデータは、32bit Machineでは扱えない、ことの対策。
32bit Machineでは、サイズの大きなDBを扱うことが出来ないことなので、、
32-bit MongoDB processes are limited to about 2.5 gb of data.
Right now there aren’t too many people for whom 64-bit is a problem, and in the long term, we think this will be a non-issue.
64bit Machineにて、再度環境構築をします(^^ゞ
環境は以下のとおりです。
- OS:window7 64bit
- CPU:inter core i7 860
- Memory:6GB
Winでの構築方法は以下のとおり。(何でもすぐに調べられる時代だ。)
Installing MongoDB as a Service on Windows 7
- Download and extract the MongoDB archive appropriate for your system. http://www.mongodb.org/display/DOCS/Downloads
- Copy the extracted folder to C: and rename it mongo.
- Create a directory called ‘data’ inside C:mongo
- Click on the Start Menu and enter “cmd” in the search box. Right-click on cmd.exe and select “Run as administrator.” This is VERY important because you won’t be able to register MongoDB as a service if you run cmd.exe with normal privileges.
- Type “C:mongobinmongod –install” to register MongoDB as a Windows service. This will probably output what may look like an error message, but don’t worry … as long as you really did run cmd.exe with administrator privileges, everything is fine.
- Click on the start menu and enter “regedit” in the search box. Click on regedit.exe, and then browse to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservices. There should be child folder there named MongoDB that has several keys inside it. If not, go back to step 4 and try again.
- The ImagePath key should read “c:mongobinmongod –service” right now; change it to “c:mongobinmongod –service –dbpath c:mongodata”. This will allow MongoDB to find its data files.
- Click on the Start Menu and enter “services” in the search box. Click on the “Component Services” option.
- In the pane on the far left, double-click on “Services (Local).” Locate MongoDB in the list in the center pane, and double click on it to bring up the properties inspector window.
- Make sure “Startup type” is set to automatic. Then click on the “Start” button.
- Browse to http://localhost:28017/ to verify that MongoDB is really running.
ここまで、相変わらずめっちゃ簡単。
次にデータの用意。ここからが、本題やからね。
[やってみる]twitter日本語ユーザのソーシャルダンプ
前回のを参考に再度データ入れる。debianとの違いは、文字コードぐらいかな。
サーバーとしていたmachineから、取得しておいたdumpを持ってくる。
FTPをいれてなかったので、こちら参考にinstall & ftpd起動。dumpをコピーする。
そして、データ投入。
【procedure for Win7】
▼インスタンス起動
mongod.exe –dbpath C:mongodata
▼dump投入
mongorestore -d twitter C:mongodumptwitter –dbpath C:mongodata
profiles/friends共に、stats確認したところ、すべて作成できている。
ようやく分析環境構築完了。
あと、文字コードの設定をcmdにて行っておく。
>chcp 65001
UTF-8に変更
profilesで@utadahikaru を検索してみる。
> db.profiles.find({‘screen_name’:/utadahikaru/i},{‘name’: 1})
{ “_id” : ObjectId(“4d3c99ddb69fff50abeb565d”), “name” : “宇多田ヒカル” }
Failed to write to logfile: errno:0 ���������������������������������������������: 000000013F20B980
{ “_id” : ObjectId(“4c725f051d41c85ccb004aac”), “name” : “宇多田ヒカルbot” }
Failed to write to logfile: errno:0 ���������������������������������������������: 000000013F20B980
log書き込めてない。
friends で@utadahikaruを検索してみる。
> db.friends.find({‘internal_id’:174511656},{‘ids’: 1})
{ “_id” : ObjectId(“4d44ca312d2d5402709ec5d0”), “ids” : [ 185509698, 174544032 ] }
よーし今日は、ここまで。
やっと、いろいろ試せる環境できたよ。
bye
[Mickey]