CentOS上MongoDB的这个Warningcentos是什么意思思

同步到微博后使用快捷导航没有帐号?
查看: 3117|回复: 11
第六周书面作业---CentOS下使用yum安装MongoDB
中级会员, 积分 380, 距离下一级还需 120 积分
论坛徽章:2
一、环境:
1.系统环境:
主机:win7
虚拟机:Vmware Workstation 6.5
OS系统:CentOS Linux release 5.6 (Final) 32位
[root@localhost etc]# cat issue
CentOS release 5.6 (Final)
Kernel \r on an \m
[root@localhost etc]# getconf LONG_BIT
2.软件版本
mongoDB版本:2.4.5& &
二、centos下安装mongodb
1.检测yum源是否有mongodb
[root@localhost ~]# yum info mongo-10gen
Loaded plugins: fastestmirror, protectbase
Determining fastest mirrors
* epel: mirrors.
* extras: mirrors.
* updates:
base& && && && && && && && && && && && && && && && && && && && && && && && &| 1.1 kB& &&&00:00& &&&
epel& && && && && && && && && && && && && && && && && && && && && && && && &| 3.6 kB& &&&00:00& &&&
epel/primary_db& && && && && && && && && && && && && && && && && && && && & | 384 kB& &&&01:20 ...
: [Errno 4] Socket Error: timed out
Trying other mirror.
: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
extras& && && && && && && && && && && && && && && && && && && && && && && & | 2.1 kB& &&&00:00& &&&
updates& && && && && && && && && && && && && && && && && && && && && && && &| 1.9 kB& &&&00:00& &&&
updates/primary_db& && && && && && && && && && && && && && && && && && && & | 521 kB& &&&00:05& &&&
0 packages excluded due to repository protections
Error: No matching Packages to list
[root@localhost ~]#
2.增加yum源
vi /etc/yum.repos.d/10gen.repo,输入下面的语句:
[root@localhost ~]# vi /etc/yum.repos.d/10gen.repo
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
第一个错误是centos是32位,结果按照老师的地址下载的是64位的,调整
[root@localhost ~]# yum info mongo-10gen-server
Loaded plugins: fastestmirror, protectbase
Loading mirror speeds from cached hostfile
* epel: mirrors.
* extras: mirrors.
* updates:
10gen& && && && && && && && && && && && && && && && && && && && && && && &&&|&&951 B& &&&00:00& &&&
10gen/primary& && && && && && && && && && && && && && && && && && && && && &|&&11 kB& &&&00:02& &&&
10gen& && && && && && && && && && && && && && && && && && && && && && && && && && && && && & 96/96
0 packages excluded due to repository protections
Error: No matching Packages to list
第二个错误是
[root@localhost ~]# yum info mongo-10gen-server
Loaded plugins: fastestmirror, protectbase
Loading mirror speeds from cached hostfile
* epel: mirrors.
* extras: mirrors.
* updates:
10gen& && && && && && && && && && && && && && && && && && && && && && && &&&|&&951 B& &&&00:00& &&&
Not using downloaded repomd.xml because it is older than what we have:
&&Current& &: Thu Jul 18 04:27:57 2013
&&Downloaded: Thu Jul 18 04:27:16 2013
0 packages excluded due to repository protections
Error: No matching Packages to list
yum的更新原则应该是会将本地的repomod.xml文件的修改日期与yum服务器的更新文件repomd.xml 作比较,然后从其中选择一份最新的文件,当发现yum服务器上的更新文件比本地的文件要旧时,就会报错啦..
解决办法:yum clean all 和 yum check-update
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror, protectbase
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@localhost ~]# yum check-update
Loaded plugins: fastestmirror, protectbase
Determining fastest mirrors
* base: mirrors.btte.net
* epel: mirrors.
* extras: mirrors.btte.net
* updates:
10gen& && && && && && && && && && && && && && && && && && && && && && && && && && &|&&951 B& &&&00:00& &&&
10gen/primary& && && && && && && && && && && && && && && && && && && && && && && & |&&11 kB& &&&00:00& &&&
10gen& && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && &&&96/96
base& && && && && && && && && && && && && && && && && && && && && && && && && && & | 1.1 kB& &&&00:00& &&&
base/primary& && && && && && && && && && && && && && && && && && && && && && && &&&| 983 kB& &&&00:15& &&&
base& && && && && && && && && && && && && && && && && && && && && && && && && && && && && && &&&
epel& && && && && && && && && && && && && && && && && && && && && && && && && && & | 3.6 kB& &&&00:00& &&&
epel/primary_db& && && && && && && && && && && && && && && && && && && && && && &&&| 3.1 MB& &&&01:11& &&&
extras& && && && && && && && && && && && && && && && && && && && && && && && && &&&| 2.1 kB& &&&00:00& &&&
extras/primary_db& && && && && && && && && && && && && && && && && && && && && && &| 167 kB& &&&00:02& &&&
updates& && && && && && && && && && && && && && && && && && && && && && && && && & | 1.9 kB& &&&00:00& &&&
updates/primary_db& && && && && && && && && && && && && && && && && && && && && &&&| 521 kB& &&&00:25& &&&
0 packages excluded due to repository protections
Deployment_Guide-zh-CN.noarch& && && && && && && & 5.8-1.el5.centos& && && && && && && && && && &&&base& &
Deployment_Guide-zh-TW.noarch& &
3.再次检测yum源是否有mongodb
~]# yum info mongo-10gen-server
Loaded plugins: fastestmirror, protectbase
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* epel: mirrors.
* extras: mirrors.btte.net
* updates:
0 packages excluded due to repository protections
Available Packages
Name& && & : mongo-10gen-server
Arch& && & : i686
Version& & : 2.4.5
Release& & : mongodb_1
Size& && & : 12 M
Repo& && & : 10gen
Summary& & : mongo server, sharding server, and support scripts
URL& && &&&:
License& & : AGPL 3.0
Description: Mongo (from &huMONGOus&) is a schema-free document-oriented database.
& && && &&&:
& && && &&&: This package provides the mongo server software, mongo sharding server
& && && &&&: softwware, default configuration files, and init.d scripts.
4.安装服务器端与客户端
[root@localhost ~]# yum install mongo-10gen-server
Loaded plugins: fastestmirror, protectbase
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* epel: mirrors.
* extras: mirrors.btte.net
* updates:
0 packages excluded due to repository protections
Setting up Install Process
Resolving Dependencies
--& Running transaction check
---& Package mongo-10gen-server.i686 0:2.4.5-mongodb_1 set to be updated
--& Processing Dependency: mongo-10gen for package: mongo-10gen-server
--& Running transaction check
---& Package mongo-10gen.i686 0:2.4.5-mongodb_1 set to be updated
--& Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================
Package& && && && && && && && && && && &Arch& && && && && && && & Version& && && && && && && && && && &Repository& && && && && && &Size
=========================================================================================================================================
Installing:
mongo-10gen-server& && && && && && && & i686& && && && && && && & 2.4.5-mongodb_1& && && && && && && & 10gen& && && && && && && &&&12 M
Installing for dependencies:
mongo-10gen& && && && && && && && && &&&i686& && && && && && && & 2.4.5-mongodb_1& && && && && && && & 10gen& && && && && && && &&&71 M
Transaction Summary
=========================================================================================================================================
Install& && & 2 Package(s)
Upgrade& && & 0 Package(s)
Total download size: 83 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): mongo-10gen-server-2.4.5-mongodb_1.i686.rpm&&(7%) 49% [====================& && && && && && && &]&&15 kB/s | 5.9 MB& &&&06:45 ETA
(2/2): mongo-10gen-2.4.5-mongodb_1.i686.rpm& && && &(16%)&&2% [-& && && && && && && && && && && && && && &]&&13 kB/s | 1.6 MB& &&&89:51 ETA
Downloading Packages:
(1/2): mongo-10gen-server-2.4.5-mongodb_1.i686.rpm& && && && && && && && && && && && && && && && && && && && && && && &|&&12 MB& &&&14:51& &&&
(2/2): mongo-10gen-2.4.5-mongodb_1.i686.rpm& && && && && && && && && && && && && && && && && && && && && && && && && & |&&71 MB& &&&37:09& &&&
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
&&Installing& &&&: mongo-10gen& && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && &1/2
&&Installing& &&&: mongo-10gen-server& && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && &&&2/2
Installed:
&&mongo-10gen-server.i686 0:2.4.5-mongodb_1& && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && &
Dependency Installed:
&&mongo-10gen.i686 0:2.4.5-mongodb_1& && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && && &
5.配置参数文件
[root@localhost ~]# cat /etc/mongod.conf
# mongo.conf
#where to log
logpath=/var/log/mongo/mongod.log
logappend=true
# fork and run in background
fork = true
#port = 27017
dbpath=/var/lib/mongo
# location of pidfile
pidfilepath = /var/run/mongodb/mongod.pid
# Disables write-ahead journaling
# nojournal = true
# Enables periodic logging of CPU utilization and I/O wait
#cpu = true
# Turn on/off security.&&Off is currently the default
#noauth = true
#auth = true
# Verbose logging output.
#verbose = true
# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true
# Enable db quota management
#quota = true
# Set oplogging level where n is
#& &0=off (default)
#& &3=both
#& &7=W+some reads
#diaglog = 0
# Ignore query hints
#nohints = true
# Disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true
# Turns off server-side scripting.&&This will result in greatly limited
# functionality
#noscripting = true
# Turns off table scans.&&Any query that would do a table scan fails.
#notablescan = true
# Disable data file preallocation.
#noprealloc = true
# Specify .ns file size for new databases.
# nssize = &size&
# Accout token for Mongo monitoring server.
#mms-token = &token&
# Server name for Mongo monitoring server.
#mms-name = &server-name&
# Ping interval for Mongo monitoring server.
#mms-interval = &seconds&
# Replication Options
# in replicated mongo databases, specify here whether this is a slave or master
#slave = true
# Slave only: specify a single database to replicate
#master = true
~]# mongod -f /etc/mongod.conf
Fri Aug&&2 14:28:43.774
Fri Aug&&2 14:28:43.780 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Fri Aug&&2 14:28:43.780
about to fork child process, waiting until server is ready for connections.
forked process: 488
all output going to: /var/log/mongo/mongod.log
child process started successfully, parent exiting
--查看进程
[root@localhost ~]# ps -aux | grep mongod
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root& && & 488&&0.1&&5.5 72 ?& && &&&Sl& &14:28& &0:00 mongod -f /etc/mongod.conf
root& && & 509&&0.0&&0.1& &4016& &664 pts/0& & S+& &14:32& &0:00 grep mongod
[root@localhost ~]# pstree -G
initqwqacpid
& &&&tqatd
& &&&tqauditdqwqaudispdqqq{audispd}
& &&&x& && &&&mq{auditd}
& &&&tqautomountqqq4*[{automount}]
&&..........
& &&&x& && && &mqscsi_eh_0
& &&&tqloginqqqbash
& &&&tqmigration/0
& &&&tqmigration/1
& &&&tq5*[mingetty]
& &&&tqmongodqqq9*[{mongod}]
& &&&tqpcscdqqq{pcscd}
& &&&tqportmap
& &&&tqrpc.idmapd
& &&&tqrpc.statd
& &&&tqsdpd
& &&&tq2*[sendmail]
& &&&tqsmartd
& &&&tqsshdqwqsshdqqqbashqqqpstree
& &&&x& && &mqsshdqqqbash
& &&&tqsyslogd
& &&&tqudevd
& &&&tqxfs
& &&&mqxinetd
[root@localhost ~]#
[root@localhost ~]# tail -400f /var/log/mongo/mongod.log
***** SERVER RESTARTED *****
Fri Aug&&2 14:28:43.986 [initandlisten] MongoDB starting : pid=488 port=27017 dbpath=/var/lib/mongo 32-bit host=localhost.localdomain
Fri Aug&&2 14:28:43.986 [initandlisten]
Fri Aug&&2 14:28:43.986 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Fri Aug&&2 14:28:43.986 [initandlisten] **& && & 32 bit builds are limited to less than 2GB of data (or less with --journal).
Fri Aug&&2 14:28:43.986 [initandlisten] **& && & Note that journaling defaults to off for 32 bit and is currently off.
Fri Aug&&2 14:28:43.986 [initandlisten] **& && & See
Fri Aug&&2 14:28:43.986 [initandlisten]
Fri Aug&&2 14:28:43.986 [initandlisten] db version v2.4.5
Fri Aug&&2 14:28:43.986 [initandlisten] git version: a2ddc68ba7c9cee17bfe69ed06602b
Fri Aug&&2 14:28:43.986 [initandlisten] build info: Linux bs-linux32.10gen.cc 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST
BOOST_LIB_VERSION=1_49
Fri Aug&&2 14:28:43.986 [initandlisten] allocator: system
Fri Aug&&2 14:28:43.986 [initandlisten] options: { config: &/etc/mongod.conf&, dbpath: &/var/lib/mongo&, fork: &true&, logappend: &true&, logpath: &/var/log/mongo/mongod.log&, pidfilepath: &/var/run/mongodb/mongod.pid& }
Fri Aug&&2 14:28:44.025 [FileAllocator] allocating new datafile /var/lib/mongo/local.ns, filling with zeroes...
Fri Aug&&2 14:28:44.025 [FileAllocator] creating directory /var/lib/mongo/_tmp
Fri Aug&&2 14:28:46.195 [FileAllocator] done allocating datafile /var/lib/mongo/local.ns, size: 16MB,&&took 2.166 secs
Fri Aug&&2 14:28:46.196 [FileAllocator] allocating new datafile /var/lib/mongo/local.0, filling with zeroes...
Fri Aug&&2 14:28:47.915 [FileAllocator] done allocating datafile /var/lib/mongo/local.0, size: 16MB,&&took 1.719 secs
Fri Aug&&2 14:28:47.920 [initandlisten] command local.$cmd command: { create: &startup_log&, size: , capped: true } ntoreturn:1 keyUpdates:0&&reslen:37 3896ms
Fri Aug&&2 14:28:47.937 [initandlisten] waiting for connections on port 27017
Fri Aug&&2 14:28:47.937 [websvr] admin web console waiting for connections on port 28017
7.简单测试
[root@localhost ~]# mongo
MongoDB shell version: 2.4.5
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type &help&.
For more comprehensive documentation, see
Questions? Try the support group
Server has startup warnings:
Fri Aug&&2 14:28:43.986 [initandlisten]
Fri Aug&&2 14:28:43.986 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Fri Aug&&2 14:28:43.986 [initandlisten] **& && & 32 bit builds are limited to less than 2GB of data (or
Fri Aug&&2 14:28:43.986 [initandlisten] **& && & Note that journaling defaults to off for 32 bit and is
Fri Aug&&2 14:28:43.986 [initandlisten] **& && & See
Fri Aug&&2 14:28:43.986 [initandlisten]
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 use to further iterate
DBQuery.shellBatchSize = x& &set default number of items to display on shell
exit& && && && && && && && & quit the mongo shell
& db.help()
DB methods:
db.addUser(userDocument)
db.adminCommand(nameOrDocument) - switches to 'admin' db, and runs command [ just calls db.runCo
db.auth(username, password)
db.cloneDatabase(fromhost)
db.commandHelp(name) returns the help for the command
db.copyDatabase(fromdb, todb, fromhost)
db.createCollection(name, { size : ..., capped : ..., max : ... } )
db.currentOp() displays currently executing operations in the db
db.dropDatabase()
db.eval(func, args) run code server-side
db.fsyncLock() flush data to disk and lock server for backups
db.fsyncUnlock() unlocks server following a db.fsyncLock()
db.getCollection(cname) same as db['cname'] ame
db.getCollectionNames()
db.getLastError() - just returns the err msg string
db.getLastErrorObj() - return full status object
db.getMongo() get the server connection object
db.getMongo().setSlaveOk() allow queries on a replication slave server
db.getName()
db.getPrevError()
db.getProfilingLevel() - deprecated
db.getProfilingStatus() - returns if profiling is on and slow threshold
db.getReplicationInfo()
db.getSiblingDB(name) get the db at the same server as this one
db.hostInfo() get details about the server's host
db.isMaster() check replica primary status
db.killOp(opid) kills the current operation in the db
db.listCommands() lists all the db commands
db.loadServerScripts() loads all the scripts in db.system.js
db.logout()
db.printCollectionStats()
db.printReplicationInfo()
db.printShardingStatus()
db.printSlaveReplicationInfo()
db.removeUser(username)
db.repairDatabase()
db.resetError()
db.runCommand(cmdObj) run a database command.&&if cmdObj is a string, turns it into { cmdObj : 1
db.serverStatus()
db.setProfilingLevel(level,&slowms&) 0=off 1=slow 2=all
db.setVerboseShell(flag) display extra information in shell output
db.shutdownServer()
db.stats()
db.version() current version of the server
& show dbs
local 0.03125GB
& show collections
& show uses
Fri Aug&&2 14:42:04.861 JavaScript execution failed: don't know how to show [uses] at src/mongo/shell/ut
& show logs
startupWarnings
--测试javascript
& Math.sin(Math.PI/2)
& new Date(&&)
ISODate(&T16:00:00Z&)
& &Hello ,World!&.replace(&World&,&MongoDb&);
Hello ,MongoDb!
& function factorial (n) {
... if (n &= 1) return 1;
... return n * factorial(n - 1);
& factorial(5);
--数据库切换
& use foobar
switched to db foobar
switched to db xyz
& use test
switched to db test
--这块需注意:不同的是切换的数据库不存在也可以成功执行,如果数据库里插入数据这个库就会真正的存在了
switched to db xax
& db.foo.insert({&bar& : &baz&});
& show dbs
local 0.03125GB
test (empty)
xax 0.0625GB
& db.foo.find()
{ &_id& : ObjectId(&51fb57bf79c8f3443ccd3df8&), &bar& : &baz& }
--查看日志
Fri Aug&&2 14:54:55.418 [FileAllocator] allocating new datafile /var/lib/mongo/xax.ns, filling with zeroes...
Fri Aug&&2 14:54:57.115 [FileAllocator] done allocating datafile /var/lib/mongo/xax.ns, size: 16MB,&&took 1.696 secs
Fri Aug&&2 14:54:57.115 [FileAllocator] allocating new datafile /var/lib/mongo/xax.0, filling with zeroes...
Fri Aug&&2 14:54:58.767 [FileAllocator] done allocating datafile /var/lib/mongo/xax.0, size: 16MB,&&took 1.652 secs
Fri Aug&&2 14:54:58.807 [FileAllocator] allocating new datafile /var/lib/mongo/xax.1, filling with zeroes...
Fri Aug&&2 14:54:58.850 [conn1] build index xax.foo { _id: 1 }
Fri Aug&&2 14:54:58.865 [conn1] build index done.&&scanned 0 total records. 0.014 secs
Fri Aug&&2 14:54:58.865 [conn1] insert xax.foo ninserted:1 keyUpdates:0 locks(micros) w:6ms
Fri Aug&&2 14:55:03.433 [FileAllocator] done allocating datafile /var/lib/mongo/xax.1, size: 32MB,&&took 4.606 secs
金牌会员, 积分 2002, 距离下一级还需 998 积分
论坛徽章:6
中级会员, 积分 380, 距离下一级还需 120 积分
论坛徽章:2
niss 发表于
谢谢,好不容易有点时间赶快把作业完成了
新手上路, 积分 3, 距离下一级还需 47 积分
论坛徽章:0
整理的很详细。我正在纳闷,老师的视频和PDF课件中是X86_64,而我机器是32位的,是否该安装那个i686..
很好很详细。。。
金牌会员, 积分 1746, 距离下一级还需 1254 积分
论坛徽章:8
刚才手动安装的&&回头我试验下&&谢谢分享
金牌会员, 积分 2909, 距离下一级还需 91 积分
论坛徽章:12
mongodb笔记整理很详细!精神可嘉!学些了!
中级会员, 积分 366, 距离下一级还需 134 积分
论坛徽章:1
真心好用啊,和我机器一个情况。
高级会员, 积分 580, 距离下一级还需 420 积分
论坛徽章:2
使用的是oracle linux,在同学的推荐下来看了这个帖子,确实在第二步“yum的更新原则应该是会将本地的repomod.xml文件的修改日期与yum服务器的更新文件repomd.xml 作比较,然后从其中选择一份最新的文件,当发现yum服务器上的更新文件比本地的文件要旧时,就会报错啦..”
金牌会员, 积分 1766, 距离下一级还需 1234 积分
论坛徽章:7
恩呢解决了自己的问题,谢谢分享
中级会员, 积分 380, 距离下一级还需 120 积分
论坛徽章:2
呵呵,能让大家少走弯路,提供帮助,也是发布本帖意思

我要回帖

更多关于 centos mongodb 启动 的文章

 

随机推荐