pgShield is a Rust-based PostgreSQL load balancer with caching and broker capabilities, designed to handle 20,000 requests per minute. It aims to optimize PostgreSQL performance and security by managing multiple databases from various locations as one and providing enhanced client services beyond traditional socket pooling.
- Features ✨
- Getting Started 🚀
- Prerequisites ✅
- Installation 🛠️
- Configuration ⚙️
- Usage 📋
- Contributing 🤝
- License 📜
- Contact 📞
- High-performance load balancing ⚖️
- Caching for improved query response times ⚡
- Broker capabilities for efficient database management 🗄️
- Supports handling multiple databases as a single entity 🗃️
- Enhanced security and optimization for PostgreSQL 🔒
For detailed instructions on getting started, please refer to the Getting Started Guide.
Before you begin, ensure you have the following:
- Rust and Cargo installed 🦀
- PostgreSQL server 🐘
- Git 🌐
-
Clone the repository:
git clone https://github.com/pgShield/pgShield.git cd pgShield -
Build the project:
cargo build --release
Create a configuration file config.json in the project root directory. Below is an example configuration:
{
"postgresql_hosts": [
{
"host": "localhost:5432",
"admin_auth_type": "trust"
},
{
"host": "example.com:5432",
"admin_auth_type": "password",
"admin_username": "postgres",
"admin_password": "mypassword"
},
{
"host": "ldap.example.com:5432",
"admin_auth_type": "ldap",
"admin_username": "admin",
"admin_password": "ldappassword"
},
{
"host": "cert.example.com:5432",
"admin_auth_type": "cert",
"admin_username": "cert_user",
"admin_password": "certpassword"
}
],
"listen_port": "8080",
"max_conns": 100,
"cache_ttl": 3600,
"health_check_interval": 60,
"replication_mode": false,
"query_cache_ttl": 600,
"logging": {
"log_to_file": true,
"log_to_console": true,
"log_to_syslog": false,
"log_dir": "/var/log/pgShield",
"syslog_facility": "LOG_USER",
"syslog_process_name": "pgShield"
}
}Run pgShield with the following command:
cargo run --releaseThis will start the pgShield server, which will begin balancing requests across your configured PostgreSQL databases.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository 🍴
- Create a new branch (
git checkout -b feature-branch) 🌿 - Make your changes and commit them (
git commit -m 'Add some feature') 💬 - Push to the branch (
git push origin feature-branch) 🚀 - Create a new Pull Request 📬
We are particularly looking for contributions in the following areas:
- Documentation 📝
- Website creation 🌐
- New ideas and feature suggestions 💡
For more details, please see our Contributing Guidelines.
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries, please contact:
Follow the project on our website for the latest updates and instructions for building, installing, configuring, and using pgShield to optimize your PostgreSQL infrastructures.