The main topic of this lesson
- Introduction and operation of RabbitMQ
- MySQL's introduction
- Python Operation MySQL API
Introduction and operation of RabbitMQ
MySQL intro operation MySQL
Install MySQL, modify the following configuration file/etc/mysql/mysql.conf.d/mysqld.cnf, change the bind=127.0.0.1 to a special IP address, you can accept the remote login.
' MyUser '@'%'mypass'myuser '@'%'; FLUSH privileges; EXIT;
Set Permissions
[Email protected]-ubuntu:~$ mysql-u myuser-h 172.16.201.134-P Enter Password:welcome to the MySQL Monitor. Commands End With; or\g.your MySQL Connection ID is5Server Version:5.7.15-0ubuntu0.16.04.1(Ubuntu) Copyright (c)+, Oracle and/orIts affiliates. All rights reserved. Oracle isA registered trademark of Oracle Corporation and/oritsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;' or '\h' forHelp. Type'\c'To clear the current input statement.mysql>
MySQL remote log in
User and Permissions actions
- Create Database
- Delete database drop databases
- Databases use database
- Creating User Create Users
- Specify Permissions GRANTS rights
Table Operations
- Creating table Create tables
- Delete Table drop tables
- Clear Table Transcate
- Creating a temporary table create temporary table
- Automatic Incremental Auto INCREMENT
- Primary KEY PRIMARY Key
- FOREIGN Key FOREIGN Key
- Constraint CONSTRAINT
- ALTER TABLE
Data manipulation
- New Data INSERT
- Deleting data Delete
- Updating Data Update
- WHERE
- JOIN
- GROUP by
- ORDER by
- INSERT into SELECT
- Output data to an external file
- Import data from an external file
Python API Operation MySQL
- Installing the Pymysql API
- Connect to MySQL
Homework this week
Job: A simple RPC (Remote call model)
- The commands and parameters that the server side will execute are sent to RABBITMQ,
- The client obtains the command to execute from RABBITMQ, and after the command executes, returns the result to the server side
- The server side accepts the command execution results from the client side and processes the
- Optionally specify a host or host group
This assignment uses the following knowledge points:
- RabbitMQ-RPC
- SQLAlchemy, Paramiko, use MySQL to save the host corresponding relationship, and then use SQLAlchemy to create the table, execute the SQL statement, and finally assign the obtained host name to the Paramiko required host parameters
References
Silver Corner King: MySQL operation
Golden Horn King:
Other: RabbitMQ Chinese documents
The 12th chapter: Pythonの Network Programming Advanced (I.)