多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區(qū)平臺 聯系我們 | 收藏本站
阿里云優(yōu)惠2
您當前位置:首頁 > 互聯網 > 新手玩?zhèn)€人服務器(阿里云centos)-mongodb安裝和啟動

新手玩?zhèn)€人服務器(阿里云centos)-mongodb安裝和啟動

來源:程序員人生   發(fā)布時間:2014-10-11 08:00:00 閱讀次數:2369次

一首《愛你的宿命》和《后會無期》,昨晚張碧晨在中國好聲音很穩(wěn)定,晉級實至名歸,雖然幾天前我從微博就知道結局了。陳冰吼過了……

今天看到草稿箱有篇沒有完成的文章,在不怎么穩(wěn)定的情緒繼續(xù)完成,畢竟最愛小二班,后會無期,往往后會有期;但是后會有期,往往后會無期,珍惜身邊愛你的人,這不是你的宿命,而是你的使命……

附上mongo在 github地址: https://github.com/mongodb/mongo/tree/master/rpm

<1>下載

wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.4.11.tgz

<2>解壓

 tar zxf mongodb-linux-i686-2.4.11.tgz

<3>安裝

(1)把mongodb安裝到 /miodata/local/mongodb

mv /usr/local/src/mongodb-linux-i686-2.4.11 /miodata/local/mongodb

(2)創(chuàng)建數據庫文件夾

 mkdir /miodata/local/mongodb/data

(3)將mongodb啟動項加入rc.local保證開機啟動mongodb

echo "/miodata/local/mongodb/bin/mongod --dbpath=/miodata/local/mongodb/data" >> /etc/rc.local

<3>啟動mongodb


安裝成功

開發(fā)模式用該安裝方法


二:生產環(huán)境的方法

運行yum命令查看MongoDB的包信息 [root@vm ~]# yum info mongo-10gen (提示沒有相關匹配的信息,) 說明你的centos系統(tǒng)中的yum源不包含MongoDB的相關資源,所以要在使用yum命令安裝MongoDB前需要增加yum源,也就是在 /etc/yum.repos.d/目錄中增加 *.repo yum源配置文件
<span style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; line-height: 18px; background-color: rgb(250, 250, 250);">我們這里就將該文件命名為:/etc/yum.repos.d/10gen.repo</span>


(1)安裝32位yum適用的RPM包,編輯/etc/yum.repos.d/10gen.repo,加入以下代碼: [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0

安裝服務器端: [root@vm ~]# yum install mongo-10gen-server 因為mongo-10gen-server包依賴于mongo-10gen,所以安裝了服務器后就不需要單獨安裝客戶端工具包mongo-10gen了 單獨安裝可客戶端: [root@vm ~]# yum install mongo-10gen



(2)安裝成功后,可以通過腳本來控制啟動/停止/重新啟動 /etc/init.d/mongodb start/stop/restart (3)這時候查看系統(tǒng)服務: chkconfig --list (4)會有一個叫 mongod 的服務了,將它設為開機啟動: chkconfig --level 345 mongod on (5)然后啟動它: service mongod start (6)這時候再查看該服務用的哪個端口: netstat -atln

(6)驗證MongoDB 可以通過檢查日志文件/var/log/mongodb/mongod.log的內容來判斷mongod進程是否正常運行。 也可以執(zhí)行命令: $ sudo chkconfig mongod on 要停止MongoDB,執(zhí)行: $ sudo service mongod stop 要重啟MongoDB,執(zhí)行: $ sudo service mongod restart


三:安全性

1:After upgrading MongoDB from version 2.4 to 2.6, I am not able to connect to it from another machine. The firewall has been checked to ensure that port 27017 is opened for the machine that I want to connect from. So what else could go wrong? Well, I was impatient and turned to you know what… Google search. According to this link: https://groups.google.com/forum/#!msg/mongodb-user/yhf05AW-hK8/YqES0cVIXlUJ, the problem is due to the database is bound to only local IP. Indeed, this was the case, and I could have found it out very easily had I run the netstat command: # netstat -tpln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 10122/mongod To fix this, modify /etc/mongod.conf to include your server’s IP. Make sure you use ‘;’ instead of ‘,’ to list IP addresses. # Listen to local interface only. Comment out to listen on all interfaces. bind_ip=127.0.0.1;123.123.123.123
</pre><pre name="code" class="plain">http://blog.khmersite.net/2014/05/mongodb-warning-failed-to-connect/


I could not understand what bind_ip in mongodb is. I could make a remote connection from desktop to the EC2 machine by having bind_ip = 0.0.0.0, but could not make it work with bind_ip = 127.0.0.1. Please explain me what bind_ip is and why it works for 0.0.0.0 and not for 127.0.0.1. For reference from mongodb docs: bind_ip Default: All interfaces. Set this option to configure the mongod or mongos process to bind to and listen for connections from applications on this address. You may attach mongod or mongos instances to any interface; however, if you attach the process to a publicly accessible interface, implement proper authentication or firewall restrictions to protect the integrity of your database. You may concatenate a list of comma separated values to bind mongod to multiple IP addresses. You can't access your machine when you bind it to 127.0.0.1 on EC2. That's not a bug, it's reasoned by the network interface bindings. 127.0.0.1 will only bind to the loopback interface (so you will only be able to access it locally), while 0.0.0.0 will bind it to all network interfaces that are available. That's why you can access your mongodb on EC2 when you bind it to 0.0.0.0(as it's available through the internet now) and not via 127.0.0.1. For local servers (like a WAMP or a local mongodb server) that won't look different to you, but for that case you should also thing that binding to 0.0.0.0 for local servers might make them available over all network interfaces (so it might be public for someone who knows your IP, if there is no firewall!) Read on a similar question on Server Fault here.
http://stackoverflow.com/questions/17588876/mongodb-conf-bind-ip-127-0-0-1-does-not-work-but-0-0-0-0-works


參閱:http://be-evil.org/install-mongodb-on-centos.html

http://www.cnblogs.com/kgdxpr/p/3519352.html


http://blog.csdn.net/chszs/article/details/23392487


http://zuoqiang.iteye.com/blog/1155069


http://www.server110.com/mongodb/201310/2737.html

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 91精品国产闺蜜国产在线闺蜜 | 日韩中文视频 | 国产美女视频爽爽爽 | 欧美视频亚洲 | 看片在线麻豆免费 | 欧美成人天天综合在线视色 | a丫久久久久久一级毛片 | 在线看片日韩 | 极品一区 | 久草免费小视频 | 最近最新高清中文字幕6页 最近最新免费中文字幕8 | 爱爱综合 | 韩国女主播一区二区三区视频 | 亚洲jizzjizz中文在线播放 | 午夜在线播放免费人成无 | 极品美女嫩模瑶瑶大尺度啪啪 | 日本高清com| 亚洲天堂视频在线观看 | 真人肉体一级毛片 | 一二三四在线观看免费中文在线观看 | 老司机午夜精品网站在线观看 | 性欧美18一19sex高清 | 免费在线网站 | 久久这里是精品 | 在线视频欧美精品 | 成人sq视频在线观看网站 | 国产亚洲精品片a77777 | 尤物视频在线 | 天天综合天天做天天综合 | 亚洲无av码一区二区三区 | 亚洲视频精品在线 | 精品乱码一区二区三区在线 | 日本成人一区二区三区 | 亚洲精品一区二区三区五区 | 久久精品伊人网 | 婷婷在线成人免费观看搜索 | 国产成人乱码一区二区三区 | 特级a欧美做爰片毛片 | 亚洲自拍小视频 | 日韩福利 | 欧美真人视频一级毛片 |