Mongodb 兩種 安裝方式

來源:互聯網
上載者:User
環境: linux 下: redhat or centos MONGODB 安裝方式1: 通過配置yum,來安裝mongodb, 企業版與一般版本: 不多說,直接看文檔 [root@dominic5 ~]# ping www.baidu.com PING www.a.shifen.com (180.97.33.71) 56(84) bytes of data. 64 bytes from 180.97.33.71: icmp_seq=1 ttl=52 time=25.3 ms 64 bytes from 180.97.33.71: icmp_seq=2 ttl=52 time=29.3 ms [root@dominic5 ~]# cat /etc/yum.repos.d/mongodb.repo   --一般版本 [mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ gpgcheck=0 enabled=1 [mongodb-enterprise-2.6]                                              --企業版本安裝 name=MongoDB Enterprise 2.6 Repository baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/2.6/$basearch/ gpgcheck=0 enabled=1 [root@dominic4 ~]#sudo yum install mongodb-org [root@dominic4 ~]# sudo yum install mongodb-enterprise
Loaded plugins: product-id, security, subscription-manager Updating Red Hat repositories. server | 1.5 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mongodb-enterprise.x86_64 0:2.6.3-1.el5 set to be updated --> Processing Dependency: mongodb-enterprise-mongos = 2.6.3 for package: mongodb-enterprise --> Processing Dependency: mongodb-enterprise-server = 2.6.3 for package: mongodb-enterprise --> Processing Dependency: mongodb-enterprise-shell = 2.6.3 for package: mongodb-enterprise --> Processing Dependency: mongodb-enterprise-tools = 2.6.3 for package: mongodb-enterprise --> Running transaction check ---> Package mongodb-enterprise-mongos.x86_64 0:2.6.3-1.el5 set to be updated ---> Package mongodb-enterprise-server.x86_64 0:2.6.3-1.el5 set to be updated --> Processing Dependency: net-snmp for package: mongodb-enterprise-server --> Processing Dependency: cyrus-sasl-gssapi for package: mongodb-enterprise-server --> Processing Dependency: libsensors.so.3()(64bit) for package: mongodb-enterprise-server ---> Package mongodb-enterprise-shell.x86_64 0:2.6.3-1.el5 set to be updated ---> Package mongodb-enterprise-tools.x86_64 0:2.6.3-1.el5 set to be updated --> Running transaction check ---> Package cyrus-sasl-gssapi.x86_64 0:2.1.22-5.el5_4.3 set to be updated ---> Package lm_sensors.x86_64 0:2.10.7-9.el5 set to be updated ---> Package net-snmp.x86_64 1:5.3.2.2-14.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================  Package Arch Version Repository Size ================================================================================================================================ Installing:  mongodb-enterprise x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 4.7 k Installing for dependencies:  cyrus-sasl-gssapi x86_64 2.1.22-5.el5_4.3 server 30 k  lm_sensors x86_64 2.10.7-9.el5 server 525 k  mongodb-enterprise-mongos x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 7.0 M  mongodb-enterprise-server x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 9.2 M  mongodb-enterprise-shell x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 4.3 M  mongodb-enterprise-tools x86_64 2.6.3-1.el5 mongodb-enterprise-2.6 90 M  net-snmp x86_64 1:5.3.2.2-14.el5 server 705 k Transaction Summary ================================================================================================================================ Install 8 Package(s) Upgrade 0 Package(s) Total size: 112 M Total download size: 1.2 M Is this ok [y/N]: Y Downloading Packages: (1/3): net-snmp-5.3.2.2-14.el5.x86_64.rpm | 705 kB 00:00 (2/3): cyrus-sasl-gssapi-2.1.22-5.el5_4.3.x86_64.rpm | 30 kB 00:00 (3/3): lm_sensors-2.10.7-9.el5.x86_64.rpm | 525 kB 00:00 -------------------------------------------------------------------------------------------------------------------------------- Total 7.8 MB/s | 1.2 MB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction   Installing : cyrus-sasl-gssapi 1/8   Installing : lm_sensors 2/8   Installing : net-snmp 3/8   Installing : mongodb-enterprise-server 4/8   Installing : mongodb-enterprise-tools 5/8   Installing : mongodb-enterprise-shell 6/8   Installing : mongodb-enterprise-mongos 7/8   Installing : mongodb-enterprise 8/8 duration: 652(ms) Installed products updated. Installed:   mongodb-enterprise.x86_64 0:2.6.3-1.el5 Dependency Installed:   cyrus-sasl-gssapi.x86_64 0:2.1.22-5.el5_4.3 lm_sensors.x86_64 0:2.10.7-9.el5   mongodb-enterprise-mongos.x86_64 0:2.6.3-1.el5 mongodb-enterprise-server.x86_64 0:2.6.3-1.el5   mongodb-enterprise-shell.x86_64 0:2.6.3-1.el5 mongodb-enterprise-tools.x86_64 0:2.6.3-1.el5   net-snmp.x86_64 1:5.3.2.2-14.el5 Complete!
----  一般版本添加檔案 You can specify any available version of MongoDB. However yum will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude directive to your /etc/yum.conf file: exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
-----企業版本添加檔案 Pin a specific version of MongoDB Enterprise. Although you can specify any available version of MongoDB Enterprise, yum will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude directive to your /etc/yum.conf file: exclude=mongodb-enterprise,mongodb-enterprise-server,mongodb-enterprise-shell,mongodb-enterprise-mong 
MONGODB 安裝方式2:
=======##### Install for 64-bit Linux Step 1: Download the binary files for the desired release of MongoDB. Download the binaries from https://www.mongodb.org/downloads. For example, to download the latest release through the shell, issue the following: curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.2.tgz   --直接下載source db Step 2: Extract the files from the downloaded archive. For example, from a system shell, you can extract through the tar command: tar -zxvf mongodb-linux-x86_64-2.6.2.tgz Step 3: Copy the extracted archive to the target directory. Copy the extracted folder to the location from which MongoDB will run. mkdir -p mongodb cp -R -n mongodb-linux-x86_64-2.6.2/ mongodb Step 4: Ensure the location of the binaries is in the PATH variable. The MongoDB binaries are in the bin/ directory of the archive. To ensure that the binaries are in your PATH, you can modify your PATH. For example, you can add the following line to your shell’s rc file (e.g. ~/.bashrc): export PATH=<mongodb-install-directory>:$PATH Replace <mongodb-install-directory> with the path to the MongoDB binaries. 方式一 安裝,啟動串連mongodb 通過mongo
mongo By default, mongo looks for a database server listening on port 27017 on the localhost interface. To connect to a server on a different port or interface, use the --port and --host options. 1. From the mongo shell, confirm you are in the mydb database by issuing the following: db
2. If mongo does not return mydb for the previous operation, set the context to the mydb database, with the following operation: use mydb
3. Create two documents named j and k by using the following sequence of JavaScript operations: j = { name : "mongo" } k = { x : 3 }
4. Insert the j and k documents into the testData collection with the following sequence of operations: db.testData.insert( j ) db.testData.insert( k ) When you insert the first document, the mongod will create both the mydb database and the testData collection.
5. Confirm that the testData collection exists. Issue the following operation: show collections The mongo shell will return the list of the collections in the current (i.e. mydb) database. At this point, the only collection is testData. All mongod databases also have a system.indexes (page 251) collection.
6. Confirm that the documents exist in the testData collection by issuing a query on the collection using the find() method: db.testData.find() This operation returns the following results. The ObjectId (page 148) values will be unique: { "_id" : ObjectId("4c2209f9f3924d31102bd84a"), "name" : "mongo" } { "_id" : ObjectId("4c2209fef3924d31102bd84b"), "x" : 3 }
----摘自官當,其他OS(windows,ubantu, suse等) 安裝,請查看官當
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.