In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail about the installation of mongodb on centos and how php extends mongodb. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Next, you will use curl. If you do not have curl installed, install curl first.
Install curl:sudo apt-get install curl libcurl3 libcurl3-dev php5-curlcurl-O-L https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.4.tgztar-zxvf mongodb-linux-x86_64-3.0.4.tgz cd mongodb-linux-x86_64-3.0.4mkdir-p / usr/local/mongodbcp-r bin/ usr/local/mongodbln-s / usr/local/mongodb/bin/mongod / usr/local/sbin/mongodmkdir-p in ubuntu / usr/local/mongodb/datavi / usr/local/mongodb/config.conf
The content to be edited is as follows
{
Dbpath=/usr/local/mongodb/data
Logpath=/usr/local/mongodb/mongdb.log
Port=27017
Fork=true
Logappend=true
}
Mongod-f / usr/local/mongodb/config.conf / / start mongodb
Let php support mongodb
First of all, you can download the corresponding expansion package at http://pecl.php.net/package/mongo. Here is my installation operation.
Wget-c http://pecl.php.net/get/mongo-1.6.10.tgztar-zxvf mongo-1.6.10.tgzcd mongo-1.6.10/usr/local/php/bin/phpize./configure-- enable-mongo=share-- with-php-config=/usr/local/php/bin/php-configmakemake installvi / etc/php.ini
Add to it
[MongoDB]
Extension=mongo.so
Then restart php-fpm.
MongoDB 3.0 user creation
There is usually no admin.
So you can execute the following command
Create admin
Mongo
Use admin
Db.createUser (
... {
... User: "nodebs"
... Pwd: "123qwe"
... Roles: [{role: "dbAdmin", db: "nodebb"}]
...}
.)
User: user name
Pwd: password
Roles: specify the role of the user, and you can set an empty role for the new user with an empty array; in the roles field, you can specify built-in roles and user-defined roles. The characters in role can be selected:
Built-In Roles (built-in roles):
1. Database user roles: read, readWrite
two。 Database management roles: dbAdmin, dbOwner, userAdmin
3. Cluster management roles: clusterAdmin, clusterManager, clusterMonitor, hostManager
4. Backup and restore roles: backup, restore
5. All database roles: readAnyDatabase, readWriteAnyDatabase, userAdminAnyDatabase, dbAdminAnyDatabase
6. Superuser role: root
/ / there are also several roles that provide access to the system superuser indirectly or directly (dbOwner, userAdmin, userAdminAnyDatabase)
7. Internal role: _ _ system
Read: allows the user to read the specified database
ReadWrite: allows users to read and write to a specified database
DbAdmin: allows users to perform administrative functions in a specified database, such as index creation, deletion, viewing statistics, or accessing system.profile
UserAdmin: allows users to write to the system.users collection. You can create, delete and manage users in a specified database.
ClusterAdmin: available only in the admin database, giving users administrative rights to all shard and replication set related functions.
ReadAnyDatabase: available only in admin databases, giving users read access to all databases
ReadWriteAnyDatabase: available only in admin databases, giving users read and write permissions to all databases
UserAdminAnyDatabase: available only in admin databases, giving users userAdmin permissions for all databases
DbAdminAnyDatabase: available only in admin databases, giving users dbAdmin permissions for all databases.
Root: available only in the admin database. Super account, super privilege
Db.createUser (
... {
... User: "zhoujinyi"
... Pwd: "zhoujinyi"
... Roles: [
... {role: "root", db: "admin"} # Super root account can perform arbitrary operations on the collection.
...]
...}
.)
About the installation of mongodb on centos and how php extends mongodb to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.