Deploying PoWA for an RDS for PostgreSQL Instance
To remotely deploy PoWA on Huawei Cloud, There must be an ECS with PoWA-archivist, PoWA-collector, and PoWA-web installed on it. This section describes how to install PoWA-archivist, PoWA-collector, and PoWA-web.
Architecture
The remote deployment architecture is as follows:
![](https://support.huaweicloud.com/intl/en-us/bestpractice-rds/en-us_image_0000001186169362.png)
Preparations
- An RDS for PostgreSQL 12.6 instance has been created.
- An ECS has been created and bound with an EIP. In this example, the ECS uses the CentOS 8.2 64-bit image.
Installing Python3
PoWA-collector and PoWA-web must be installed in a Python3 environment. You can use pip3 to install them to facilitate the installation. In this example, Python 3.6.8 is installed on the ECS by default. The latest PoWA version fails to be installed. For details about how to install the latest version, see Installing Python 3.9.9.
Installing PoWA-archivist
- Run the wget command to obtain the PoWA-archivist source code.
wget https://github.com/powa-team/powa-archivist/archive/refs/tags/REL_4_1_2.tar.gz
- Decompress the downloaded REL_4_1_2.tar.gz package.
- Install PoWA-archivist to the decompressed directory.
make && make install
Installing PoWA-collector and PoWA-web
- Switch to the RDS for PostgreSQL database user. Take user postgres as an example.
su - postgres
- Install PoWA-collector and PoWA-web. psycopg2 is mandatory for installing them.
pip install psycopg2 pip install powa-collector pip install powa-web
After the installation is complete, check the following path tree. If the following information is displayed, the PoWA-collector and PoWA-web have been installed.
/home/postgres/.local/bin ├── powa-collector.py ├── powa-web └── __pycache__
Creating the PoWA Extension
- Log in to the powa database of the RDS for PostgreSQL instance as user root. (If the powa database does not exist, create it first.)
- Create the powa extension in the powa database.
select control_extension('create', 'pg_stat_statements'); select control_extension('create', 'btree_gist'); select control_extension('create', 'powa');
FAQs
Q: What should I do if the error message "python setup.py build_ext --pg-config /path/to/pg_config build" is displayed when the pip install psycopg2 command is executed?
A: You need to add the bin and lib paths of RDS for PostgreSQL to environment variables and run the pip install psycopg2 command.
Installing Python 3.9.9
- Prepare the environment.
Perform the following operations in sequence. Otherwise, Python 3.9.9 may fail to be installed (for example, SSL component dependency fails). As a result, PoWA-collector and PoWA-web fail to be installed.
yum install readline* -y yum install zlib* -y yum install gcc-c++ -y yum install sqlite* -y yum install openssl-* -y yum install libffi* -y
- Install Python 3.9.9.
- Run the following commands as user root:
mkdir env cd env wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz tar -xzvf Python-3.9.9.tgz cd Python-3.9.9 ./configure --prefix=/usr/local/python3.9.9 make && make install
- Create a soft link.
ln -s /usr/local/python3.9.9/bin/python3.9 /usr/bin/python ln -s /usr/local/python3.9.9/bin/pip3.9 /usr/bin/pip
- Run the following commands as user root:
- Check whether the installation is successful.
- Verify the installation, especially the SSL function.
[root@ecs-ad4d Python-3.9.9]# python Python 3.9.9 (main, Nov 25 2021, 12:36:32) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. import ssl import urllib.request context = ssl._create_unverified_context() urllib.request.urlopen('https://www.example.com/',context=context).read()
- If any command output is displayed, the installation is successful. Run the following command to exit:
quit()
- Verify the installation, especially the SSL function.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot