Mysql Proxy LuaInternalStructureBody andVariableIs the content to be introduced in this article, mainly to learnMysql ProxyOfStructureBody andVariableFor more information, see this article.
Mysql ProxyOfLUAMany internal structures can be used in the configuration script. The most important one is proxy. proxy provides many other struct interfaces, such as the connection list and backend server list. Structures from customers such as incoming packet only exist in the context of script functions.
Attribute description:
- Connection: contains the connection proxy. connection list of all active customers ..
- Servers: List of backend servers proxy. backends)
- Queries: the query that a customer wants to send to the server
- PROXY_VERSION: Mysql Proxy version, in hexadecimal format.
Proxy. connection
Proxy. connection is a read-only object that provides information about the current active connection.
Proxy. connection attributes:
Thread_id: Connection threadid
Backend_ndx: ID of the backend server corresponding to the current connection
Proxy. backends
The proxy. backends part is writable and contains a list of background server and server meta information. You can specify the backend server used by the current connection.
Proxy. backends attributes:
Address: Host Name/Port Combination of the current connection
Connected_clients: number of connected customers
State: the status of the backend server.
Proxy. queries
Proxy. queries is a query queue to be sent to the server,
- The queue is not populated automatically, but if you do not explicitly populate the queue then queries are
- passed on to the backend server verbatim. Also, if you do not populate the query queue by hand,
- then the read_query_result() function is not triggered.
- The following methods are supported for populating the proxy.queries object.
Function Description:
- Append (id, packet) is added to the end of the team.
- Prepend (id, packet) inserts the queue header.
- Len () returns the length of the queried queue
The following constant Mysql Proxy is used to specify the operation:
- PROXY_SEND_QUERY is sent to the server.
- PROXY_SEND_RESULT: return the client Query Result
- PROXY_IGNORE_RESULT discard result set
Package status constant:
- MYSQLD_PACKET_OK The packet is OK.
- MYSQLD_PACKET_ERR The packet contains error information.
- MYSQLD_PACKET_RAW The packet contains raw data.
Constant background status:
- BACKEND_STATE_UNKNOWN The current status is unknown.
- BACKEND_STATE_UP The backend is known to be up (available ).
- BACKEND_STATE_DOWN The backend is known to be down (unavailable ).
- BACKEND_TYPE_UNKNOWN Backend type is unknown.
- BACKEND_TYPE_RW Backend is available for read/write.
- BACKEND_TYPE_RO Backend is available only for read-only use.
-
- Server command constant:
-
- Constant Description
- COM_SLEEP Sleep
- COM_QUIT Quit
- COM_INIT_DB Initialize database
- COM_QUERY Query
- COM_FIELD_LIST Field List
- COM_CREATE_DB Create database
- COM_DROP_DB Drop database
- COM_REFRESH Refresh
- COM_SHUTDOWN Shutdown
- COM_STATISTICS Statistics
- COM_PROCESS_INFO Process List
- COM_CONNECT Connect
- COM_PROCESS_KILL Kill
- COM_DEBUG Debug
- COM_PING Ping
- COM_TIME Time
- COM_DELAYED_INSERT Delayed insert
- COM_CHANGE_USER Change user
- COM_BINLOG_DUMP Binlog dump
- COM_TABLE_DUMP Table dump
- COM_CONNECT_OUT Connect out
- COM_REGISTER_SLAVE Register slave
- COM_STMT_PREPARE Prepare server-side statement
- COM_STMT_EXECUTE Execute server-side statement
- COM_STMT_SEND_LONG_DATA Long data
- COM_STMT_CLOSE Close server-side statement
- COM_STMT_RESET Reset statement
- COM_SET_OPTION Set option
- COM_STMT_FETCH Fetch statement
- COM_DAEMON Daemon (MySQL 5.1 only)
- COM_ERROR Error
MySQL Data Type
- Constant Field Type
- MYSQL_TYPE_DECIMAL Decimal
- MYSQL_TYPE_NEWDECIMAL Decimal (MySQL 5.0 or later)
- MYSQL_TYPE_TINY Tiny
- MYSQL_TYPE_SHORT Short
- MYSQL_TYPE_LONG Long
- MYSQL_TYPE_FLOAT Float
- MYSQL_TYPE_DOUBLE Double
- MYSQL_TYPE_NULL Null
- MYSQL_TYPE_TIMESTAMP Timestamp
- MYSQL_TYPE_LONGLONG Long long
- MYSQL_TYPE_INT24 Integer
- MYSQL_TYPE_DATE Date
- MYSQL_TYPE_TIME Time
- MYSQL_TYPE_DATETIME Datetime
- MYSQL_TYPE_YEAR Year
- MYSQL_TYPE_NEWDATE Date (MySQL 5.0 or later)
- MYSQL_TYPE_ENUM Enumeration
- MYSQL_TYPE_SET Set
- MYSQL_TYPE_TINY_BLOB Tiny Blob
- MYSQL_TYPE_MEDIUM_BLOB Medium Blob
- MYSQL_TYPE_LONG_BLOB Long Blob
- MYSQL_TYPE_BLOB Blob
- MYSQL_TYPE_VAR_STRING Varstring
- MYSQL_TYPE_STRING String
- MYSQL_TYPE_TINY Tiny (compatible with MYSQL_TYPE_CHAR)
- MYSQL_TYPE_ENUM Enumeration (compatible with MYSQL_TYPE_INTERVAL)
- MYSQL_TYPE_GEOMETRY Geometry
- MYSQL_TYPE_BIT Bit
Summary: DetailsMysql Proxy LuaInternalStructureBody andVariableI hope this article will help you!