centos 安装 mongo3.0
官方网站传贴,每次去翻doc,麻烦
vi /etc/yum.repos.d/mongodb-org-3.0.repo
[mongodb-org-3.0]name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/gpgcheck=0enabled=1
sudo yum install -y mongodb-org
#sudo yum install -y mongodb-org-3.0.7 mongodb-org-server-3.0.7 mongodb-org-shell-3.0.7 mongodb
vi /etc/selinux/config
sudo yum erase $(rpm -qa | grep mongodb-org)
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo -------偷懒----
wget: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1410-clang-3.0.3.tgz tar -zxvf mongodb.tgz 目录层次
~/mongodb
m/data
s1/data
s2/data
a/data
log config:
#master.conf
dbpath=~/mongodb/m/data
logpath=~/mongodb/log/m.log
pidfilepath=~/mongodb/m.pid
directoryperdb=true
logappend=true
replSet=virus
port=27017
oplogSize=10000
fork=true
noprealloc=true #slaver.conf
dbpath=~/mongodb/s1/data
logpath=~/mongodb/log/s1.log
pidfilepath=~/mongodb/s1.pid
directoryperdb=true
logappend=true
replSet=virus
port=27018
oplogSize=10000
fork=true
noprealloc=true #slaver.conf
dbpath=~/mongodb/s2/data
logpath=~/mongodb/log/s2.log
pidfilepath=~/mongodb/s2.pid
directoryperdb=true
logappend=true
replSet=virus
port=27019
oplogSize=10000
fork=true
noprealloc=true #arbiter.conf
dbpath=~/mongodb/a/data
logpath=~/mongodb/log/a.log
pidfilepath=~/mongodb/a.pid
directoryperdb=true
logappend=true
replSet=virus
port=27010
oplogSize=10000
fork=true
noprealloc=true 启动命令:
cd ~/mongodb/m/bin
./mongod -f s.conf cd ~/mongodb/s1/bin
./mongod -f s.conf cd ~/mongodb/s2/bin
./mongod -f s.conf cd ~/mongodb/a/bin
./mongod -f s.conf 配置:
cd ~/mongodb/m/bin
./mongo
use admin cfg={ _id:"virus", members:[ {_id:0,host:'127.0.0.1:27017',priority:1}, {_id:1,host:'127.0.0.1:27018',priority:2},
{_id:2,host:'127.0.0.1:27019',priority:3},
{_id:3,host:'127.0.0.1:27010',arbiterOnly:true}] };
rs.initiate(cfg) ----当然可以按照下面这个来---
设置启动用的代码改centos+Ubuntu的嘿嘿,偷懒啊。。。
#!/bin/bash # mongod - Startup script for mongod # chkconfig:
# description: Mongo is a scalable, document-oriented database.
# processname: mongod
# config: /etc/mongod.conf
# pidfile: /var/run/mongodb/mongod.pid . /etc/rc.d/init.d/functions
. /lib/lsb/init-functions
# things from mongod.conf get there by mongod reading it # NOTE: if you change any OPTIONS here, you get what you pay for:
# this script assumes all options are in the config file.
#centos下配置文件里面oplogSize=10000 会报错。。莫名,自己改下文件名称
CONFIGFILE="/opt/mongodb/master.conf"
OPTIONS=" -f $CONFIGFILE"
SYSCONFIG="/opt/mongodb/sysconfig" # FIXME: 1.9.x has a --shutdown flag that parses the config file and
# shuts down the correct running pid, but that's unavailable in 1.8
# for now. This can go away when this script stops supporting 1.8.
DBPATH=`awk -F'[:=]' -v IGNORECASE= '/^[[:blank:]]*dbpath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d '[:blank:]'`
PIDFILE=`awk -F'[:=]' -v IGNORECASE= '/^[[:blank:]]*pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d '[:blank:]'`
PIDDIR=`dirname $PIDFILE` #mongod=${MONGOD-/usr/bin/mongod}
mongod="/opt/mongodb/bin/mongod" MONGO_USER=root
MONGO_GROUP=root if [ -f "$SYSCONFIG" ]; then
. "$SYSCONFIG"
fi # Handle NUMA access to CPUs (SERVER-)
# This verifies the existence of numactl as well as testing that the command works
NUMACTL_ARGS="--interleave=all"
if which numactl >/dev/null >/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null >/dev/null
then
NUMACTL="numactl $NUMACTL_ARGS"
else
NUMACTL=""
fi start()
{
# Make sure the default pidfile directory exists
echo $PIDDIR
if [ ! -d $PIDDIR ]; then
install -d -m -o $MONGO_USER -g $MONGO_GROUP $PIDDIR
fi # Recommended ulimit values for mongod or mongos
# See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
#
ulimit -f unlimited
ulimit -t unlimited
ulimit -v unlimited
ulimit -n
ulimit -m unlimited
ulimit -u echo -n $"Starting mongod: "
daemon --user "$MONGO_USER" --check $mongod "$NUMACTL $mongod $OPTIONS >/dev/null 2>&1"
RETVAL=$?
echo
[ $RETVAL -eq ] && touch /var/lock/subsys/mongod
}
stop()
{
MONGOPID=`ps -ef | grep 'mongod' | grep -v grep | awk '{print $2}'`
#echo "$MONGOPID"
echo -n "Stopping MongoDB server"
if [ ! -z "$MONGOPID" ]; then
kill - $MONGOPID
echo -n "Stopped -----> $MONGOPID"
fi
RETVAL=$?
echo
[ $RETVAL -eq ] && rm -f /var/lock/subsys/mongod
} restart () {
stop
start
} RETVAL= case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/mongod ] && restart || :
;;
status)
status $mongod
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
RETVAL=
esac exit $RETVAL
centos 安装 mongo3.0的更多相关文章
- 【推荐】CentOS安装Tomcat-7.0.57+启动配置+安全配置+性能配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Tomcat之前,请确保已经安装了JDK-1.7环境,具体见<CentOS安装JDK-1.7>. ...
- 【推荐】CentOS安装vsftpd-3.0.2+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. FTP的登录一般有三种方式,分别是: 匿名用户形式:默认安装的情况下,系统只提供匿名用户访问,只需要输入用户anonymous/f ...
- centos 安装php7.0.2
PHP7.0正式版已经在2015年11月份左右发布,目前是PHP7.0.2版本,本人最早是从2015年8月php7的第一个测试版跟起,现在正式版发布. linux版本:64位CentOS 6.6 Ng ...
- 【推荐】CentOS安装vsftpd-3.0.3+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. FTP的登录一般有三种方式,分别是: 匿名用户形式:默认安装的情况下,系统只提供匿名用户访问,只需要输入用户anonymous/f ...
- CentOS 安装mongodb3.0 二进制包
1.下载mongodb因为64位系统CentOS,所以下载64位的安装包: wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0 ...
- CentOS安装GlassFish4.0 配置JDBC连接MySQL
转自:http://linux.it.net.cn/CentOS/course/2014/0724/3319.html 版本glassfish-4.0.zip 1.解压,拷贝到指定安装路径 unz ...
- centos 安装mysql8.0.16
清除自带的mariadb > rpm -qa|grep mariadb mariadb-libs-5.5.44-2.el7.centos.x86_64 > rpm -e --nodeps ...
- centos安装tomcat7.0.70
抄自:https://www.cnblogs.com/www1707/p/6592504.html apache-tomcat-7.0.70jdk-7u67-linux-x64 下载tomcathtt ...
- centos 安装mongodb3.0
一.添加yum源 vi /etc/yum.repos.d/mongodb-org-3.0.repo 请添加如下配置(64位系统): [mongodb-org-3.0] name=MongoDB Rep ...
随机推荐
- bzoj 1449 [JSOI2009]球队收益(费用拆分,最小费用流)
1449: [JSOI2009]球队收益 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 547 Solved: 302[Submit][Status][ ...
- springboot的restController使用swagger遇到的问题。
在controller中使用swagger,使用注解ApiImplicitParam遇到一个问题 当方法的参数是走path的swggerui的参数展现是正常的, @PathVariable 但如果是走 ...
- [Locked] Count Univalue Subtrees
Count Univalue Subtrees Given a binary tree, count the number of uni-value subtrees. A Uni-value sub ...
- SRM 597
我果然是题短了就能做得好- -.Div 2的三道题都短,于是迅速的过掉了250和500,rating涨了150^ ^. Div 2 250pt 题意:给一个vector<int> A,对其 ...
- selenium grid java 资料
Grid TestNG: 使用Selenium Grid改进Web应用程序的测试: http://www.ithov.com/server/117464.shtml
- 69个spring面试题及答案
Spring 概述 1. 什么是spring? Spring 是个Java企业级应用的开源开发框架.Spring主要用来开发Java应用,但是有些扩展是针对构建J2EE平台的web应用.Spring ...
- OPENCV第一篇
了解过之前老版本OpenCV的童鞋们都应该清楚,对于OpenCV1.0时代的基于 C 语言接口而建的图像存储格式IplImage*,如果在退出前忘记release掉的话,就会照成内存泄露.而且用起来超 ...
- js中的运算符和条件语句
js中的运算符大体上可以分为4类:1算术运算符.2一元操作符.3比较运算符.4逻辑运算符. 算术运算符一般指的是加减乘除求余这五种操作符:+,-,*,/,%.通过算术运算符可以对js中的变量进行操作. ...
- python获取本机IP、mac地址、计算机名
在python中获取ip地址和在php中有很大不同,在php中往往比较简单.那再python中怎么做呢? 我们先来看一下python 获得本机MAC地址: 1 2 3 4 import uuid de ...
- evernote出现“Sync failed due to unexpected problem at server side”的问题
继上次的"Invalid username and/or password"问题之后,evernote又出现了“Sync failed due to unexpected prob ...