YMatrix
Quick Start
Simulate Time Series Scenarios
Standard Cluster Deployment
Data Modeling
Connecting to The database
Data Writing
Data Migration
Data Query
Scene Application Examples
Federal Query
Maintenance and Monitoring
Global Maintenance
Partition Maintenance
Backup and Restore
Cluster Expansion
Enable Mirroring
Resource Management
Security
Monitoring
Performance Tuning
Troubleshooting
Reference Guide
Tool Guide
Data Type
Storage Engine
Execution Engine
Stream Processing
DR (Disaster Recovery)
Configuration Parameters
Index
Extension
SQL Reference
FAQ
YMatrix 6 We provide cluster operation and maintenance tools: mxstart, mxstop, mxstate.
Notes!
For the first time in YMatrix 5, the above-mentioned operation and maintenance tool management cluster is available. For more information about YMatrix 5 architecture, please refer to YMatrix 5 Architecture. The Greenplum series operation and maintenance tools are used by default in YMatrix 4 (MatrixDB 4). For details, please refer to [YMatrix 4 Cluster Basic Management] (/doc/4.8/get_started/basic_management).
mxstart -a # Start the cluster
mxstop -a # Stop the cluster (may hang if sessions are connected)
mxstop -a -M fast # Fast - mode shutdown
mxstop -ar # Restart, waiting for ongoing SQL to finish (may hang if sessions are connected)
mxstop -ar -M fast # Fast - mode restart
mxstop -u # Reload configuration files
mmxstate # Check cluster status
mxstate -s # Check the entire YMatrix cluster's status
mxstate -m # List Mirrors
mxstate -f # Show Standby Master info
Display configuration values:
gpconfig -s {GUC}
# Example: Check the maximum number of connections allowed
gpconfig -s max_connections
Modify the configuration value:
gpconfig -c {GUC} -v {Value} -m {Value} # -m specifies the master node parameter value, -v specifies the segment node parameter value
gpconfig -c {GUC} -v {Value} # When -m is not specified, the parameter modifications of the master node are consistent with those of the segment node.
# example:
gpconfig -c max_connections -v 1000 -m 300
gpconfig -c shared_buffers -v 2GB
psql -d ${db_name} -U ${user_name} -h ${ip_addr} -p ${port}
Modify environment variables and add the default value of psql:
# You can modify the default value by modifying the environment variables
vi ~/.bash_profile # Edit with mxadmin user, add variables:
export PGPORT=5432 # Default port
export PGUSER=mxadmin # Default user
export PGDATABASE=postgres # Default database
Make environment variables effective immediately:
source ~/.bash_profile
Log in to the database using SQL again:
# Execute psql to log in to the database
psql
# The default value at this time is
psql -d postgres -U mxadmin -h localhost -p 5432
\l List all databases.
\d List tables, views, sequences in the current database
\d [table_name] Show table structure
\dt Show matching tables.
\di Show indexes.
\dt+ table_name Check table size.
\di+ index_name Check index size.
\ds Show sequences.
\dv Show views.
\dm Show materialized views.
\df Show functions.
\dn List schemas.
\du or \dg List roles/users.
\dp or \z Show table permissions.
\dx Show extension info.
\sf function_name Show function code.
\h Show SQL command explanation.
\? List psql commands.
\c Show current DB and connection info.
\c [database_name] Connect to another DB.
\e Open text editor.
\x Set query result output
\! Execute OS command
\o /home/postgres/test.txt Save results to file (close with \o)
\drds Show RDS - related info
\s Show history
\watch 1 Repeat last command every 1 second
Method 1, use the createdb tool to create:
createdb test
Method 2: Create using the CREATE DATABASE
SQL statement:
psql postgres
postgres=# create database test;
Method 1, use the dropdb tool to delete:
dropdb test
Method 2: Create using the DROP DATABASE
SQL statement:
psql postgres
postgres=# drop database test;