In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Introduction to NoSQL
NoSQL (NoSQL = Not Only SQL), which means "not just SQL".
In modern computing systems, a huge amount of data is generated on the network every day.
A large part of this data is processed by relational database management systems (RDBMS). The paper "A relational model of data for large shared data banks" of relational model proposed by E.F.Codd's in 1970 makes data modeling and application programming easier.
Through the application practice, it is proved that the relational model is very suitable for client-server programming, far beyond the expected benefits. today, it is the leading technology of structured data storage in network and business applications.
NoSQL is a new revolutionary movement of database, and it was suggested in the early days that the trend became higher and higher in 2009. Proponents of NoSQL advocate the use of non-relational data storage, compared with the overwhelming use of relational databases, this concept is undoubtedly the injection of a new kind of thinking.
Relational databases follow ACID rules
Transaction is transaction in English, which is similar to real-world transaction. It has the following four features:
1. A (Atomicity) atomicity
Atomicity is easy to understand, that is, all operations in the transaction are either completed or not done. The condition for the success of a transaction is that all operations in the transaction are successful. As long as one operation fails, the whole transaction fails and needs to be rolled back.
For example, a bank transfer of 100 yuan from An account to B account is divided into two steps: 1) withdraw 100 yuan from An account; 2) deposit 100 yuan to B account. These two steps are either completed together or not together. If only the first step is completed and the second step fails, the money will be inexplicably less than 100 yuan.
2. C (Consistency) consistency
Consistency is also easy to understand, that is, the database should be in a consistent state all the time, and the operation of the transaction will not change the original consistency constraints of the database.
For example, the existing integrity constraint a+b=10, if a transaction changes a, then b must be changed so that the transaction still satisfies a+b=10 after the transaction ends, otherwise the transaction fails.
3. I (Isolation) independence
The so-called independence means that concurrent transactions will not affect each other. If the data accessed by one transaction is being modified by another transaction, as long as another transaction is not committed, the data accessed by it will not be affected by the uncommitted transaction.
For example, there is a transaction that transfers 100 yuan from An account to B account. In the case that the transaction has not been completed, if B inquires about his own account at this time, he will not see the new 100 yuan.
4. D (Durability) persistence
Persistence means that once a transaction is committed, its changes will be permanently stored on the database and will not be lost even if there is an outage.
Yum installation process
Configure YUM Source Warehouse
Cd / etc/yum.repos.d/vim mongodb-org.repo writes the following [mongodb-org] name=MongoDBRepositorybaseurl= https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/gpgcheck=1enabled=1 gpgkey= https://www.mongodb.org/static/pgp/server-3.6.asc installation yum listyum install mongodb-org-y
Basic configuration
Vim / etc/mongod.conf is modified as follows: net: port: 27017 bindIp: 0.0.0.0 / allow everyone to access systemctl start mongod.service / start service replication: replSetName: yang / define replication set name netstat-ntap | grep 27017 / check whether the port is open
Multi-instance operation process
Add three instances of 2.3.4 below
Create a new save point
Mkdir-p / data/mongodb/mongodb {2jue 3j 4} / first create data file storage location mkdir-p / data/mongodb/logs/ log file location touch / data/mongodb/logs/mongodb {2jue 3 4} .log / log file chmod 777 / data/mongodb/logs/*.log / weight log file cd / data/mongodb/ / check whether the operation works [root@cent mongodb] # lslogs mongodb2 mongodb3 mongodb4 [root@cent mongodb] # cd logs/ [root@cent logs] # ll total usage 0-rwxrwxrwx. 1 root root 0 September 12 09:48 mongodb2.log-rwxrwxrwx. 1 root root 0 September 12 09:48 mongodb3.log-rwxrwxrwx. 1 root root 0 September 12 09:48 mongodb4.log
Edit the configuration file for 2.3.4
Vim / etc/mongod2.conf is modified as follows: systemLog: destination: file logAppend: true path: / the following 3jue 4 will be changed to mongodb3.log storage: dbPath: / the following 3jue 4 will be changed to mongodb3 journal: enabled: truenet: port: / / the following 3Jing 4 will be changed to 27019 bindIp: 0.0.0.0replication: replSetName: yang
Startup and detection
Open the service [root@cent logs] # mongod-f / etc/mongod2.conf about to fork child process, waiting until server is ready for connections.forked process: 83795child process started successfully, parent exiting [root@cent logs] # mongod-f / etc/mongod3.conf about to fork child process, waiting until server is ready for connections.forked process: 83823child process started successfully, parent exiting [root@cent logs] # mongod-f / etc/mongod4.conf about to fork child process, waiting until server is ready for connections.forked process: 83851child process started successfully Parent exiting [root@cent logs] # netstat-ntap / Inspection Port See 27017pr 18pr 19 respectively 20Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 27017 0.0.0.0 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp * LISTEN 83597/mongod tcp 0 0 0.0.0.0 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 27018 0.0.0.0 LISTEN 83795/mongod tcp 0 0 0.0.0.0 LISTEN 83851/mongod tcp 27019 0.0.0.0 LISTEN 83851/mongod tcp 0 0 0.0.0.0 LISTEN 83851/mongod tcp 0 0 0.0.0.0 : 111 0.0.0.0 LISTEN 745/rpcbind tcp 0 192.168.122.1 LISTEN 53 0.0.0.0 LISTEN 4548/dnsmasq tcp 00 0.0.0.0 LISTEN 1199/sshd tcp 0 0127.0.0.1 LISTEN 2997/master tcp 0127.0.0.0.1 LISTEN 2997/master tcp 0 0127.0.0.1 LISTEN 2997/master tcp : 6010 0.0.0.0 ESTABLISHED 21813/sshd * LISTEN 21813/sshd: root@pt tcp 00 192.168.137.11 ESTABLISHED 21813/sshd 22 192.168.137.1 ESTABLISHED 21813/sshd: 111:: * LISTEN 745/rpcbind tcp6 0 0:: 22: * LISTEN 1199/sshd tcp6 0 0:: 1 LISTEN 1202/cupsd tcp6 0 0:: 1:25: * LISTEN 2997/master tcp6 0 0:: 1 LISTEN 2997/master tcp6 6010: * LISTEN 21813/sshd: root@pt
Landing test
[root@cent logs] # mongo-- port 27019 / designated port login MongoDB shell version v3.6.7connecting to: mongodb://127.0.0.1:27019/MongoDB server version: 3.6.7 >
Done!
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.