符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
首先从官网下载mongodb的安装包http://www.mongodb.org/downloads我的系统是redhat5.8所有选择相应的版本包就ok现在最新版是3.0.3
创新互联公司主要从事成都做网站、成都网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务成华,10余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792解压mongodb-linux-x86_64-rhel55-3.0.3.tgz
3.创建mongodb用户
[root@mongodb /]# useradd mongodb4.创建相应文件目录并修改权限
[root@mongodb /]# mkdir /data/db -p [root@mongodb /]# chown mongodb:mongodb /data/ -R [root@mongodb opt]# chown -R mongodb:mongodb /opt/*5.添加PATH环境变量在shell下正常访问mongodb的应用工具
[root@mongodb bin]# vim /etc/profile.d/mongodb.sh export PATH=$PATH:/opt/mongodb/bin [root@mongodb bin]# source /etc/profile.d/mongodb.sh [root@mongodb bin]# echo $PATH /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/mongodb/bin6.创建mongodb的PID存放目录
[root@mongodb run]# mkdir /var/run/mongodb [root@mongodb run]# chown mongodb:mongodb /var/run/mongodb/ -R [root@mongodb opt]# mongod --dbpath /data/db/ --logpath /var/log/mongodb.log --logappend --port 27017 --pidfilepath /var/run/mongodb/mongodb.pid --maxConns 250 --rest --httpinterface --fork about to fork child process, waiting until server is ready for connections. forked process: 4060 child process started successfully, parent exiting --maxConns 250 :表示大连接数是250个 --rest --httpinterface : web接口,指定这项28017端口才能启用 --fork :后台运行7.安装过程中遇见的问题
装好之后连接出现以下警告
(1).[root@mongodb ~]# mongo MongoDB shell version: 3.0.3 connecting to: test Server has startup warnings: 2015-06-15T20:27:49.892+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. 2015-06-15T20:27:49.892+0800 I CONTROL [initandlisten]出现这个问题就查看关于mongodb的文件权限,主要是/opt /data/db/ /var/run/mongodb/ /var/log/mongodb.log的权限因为启动初始化时以root用户的权限在运行,所以这些目录下的权限可能会变成root root
(2).[mongodb@mongodb db]$ mongod --dbpath /data/db/ --logpath /var/log/mongodb.log --logappend --port 27017 --pidfilepath /var/run/mongodb/mongodb.pid --maxConns 250 --rest --httpinterface --fork 2015-06-15T17:41:25.721+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2015-06-15T17:41:25.721+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never' 2015-06-15T17:41:25.721+0800 I CONTROL [initandlisten] 2015-06-15T17:41:25.721+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. 2015-06-15T17:41:25.721+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'修改两个参数即可
echo "never" > /sys/kernel/mm/transparent_hugepage/enabled echo "never" > /sys/kernel/mm/transparent_hugepage/defrag8.安装成功并登录
[root@mongodb ~]# ss -tanlp | grep mongod 0 0 *:27017 *:* users:(("mongod",4095,6)) 0 0 *:28017 *:* users:(("mongod",4095,8)) [root@mongodb ~]# mongo MongoDB shell version: 3.0.3 connecting to: test > 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登录web接口 28017端口
9.关闭服务器
(1).[root@mongodb ~]# mongod --shutdown killing process with pid: 3936 (2).[root@mongodb ~]# killall mongod10.给mongodb编写配置文件/etc/mongodb.conf
[root@mongodb ~]# grep -v ^# /etc/mongodb.conf logpath=/var/log/mongodb.log logappend=true fork = true dbpath=/data/db pidfilepath = /var/run/mongodb/mongodb.pid rest = true httpinterface = true启动
[root@mongodb ~]# mongod -f /etc/mongodb.conf about to fork child process, waiting until server is ready for connections. forked process: 4169 child process started successfully, parent exiting [root@mongodb ~]# ss -tanlp | grep mongod 0 0 *:27017 *:* users:(("mongod",4169,6)) 0 0 *:28017 *:* users:(("mongod",4169,8))11.用service mongodb * 来启动mongodb
启动脚本:/etc/rc.d/init.d/mongod
测试启动
[root@mongodb ~]# service mongod start Starting mongod: about to fork child process, waiting until server is ready for connections. forked process: 4426 child process started successfully, parent exiting [ OK ] [root@mongodb init.d]# ss -tanlp | grep mongod 0 0 *:27017 *:* users:(("mongod",4426,6)) 0 0 *:28017 *:* users:(("mongod",4426,8)) [root@mongodb ~]# mongo MongoDB shell version: 3.0.3 connecting to: test > [root@mongodb ~]# service mongod start Starting mongod: about to fork child process, waiting until server is ready for connections. forked process: 4426 child process started successfully, parent exiting [ OK ] [root@mongodb ~]# service mongod stop Stopping mongod: [ OK ]另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。