This script automates the configuration of a secure, high-availability multi-server environment with MariaDB master-slave replication, Memcached for session storage, and necessary security configurations. It creates a production-ready environment while addressing security, performance, and reliability concerns.
- Automated MariaDB master-slave replication setup
- Secure credentials management with strong password generation
- Memcached distributed session storage
- Redis configuration for memory caching
- PHP environment setup with required extensions
- Web server configuration with basic authentication
- Support for both single-server and multi-server deployments
- Comprehensive logging of the installation process
- Ubuntu/Debian-based operating system
- Root or sudo access
- Network connectivity between servers
- DNS resolution configured properly
- Open ports: 3306 (MariaDB), 11211 (Memcached), 6379 (Redis)
- Download the script:
wget https://raw.githubusercontent.com/CodonoTeam/cryptocurrency-exchange-script/main/docs/multi_server/multi-server-setup.sh chmod +x multi-server-setup.sh
- Run the script:
./multi-server-setup.sh
- Follow the prompts:
- Enter your domain name
- Choose "n" for multi-server setup
- Enter the master server IP
- Enter the slave server IP
- Copy the credentials.yml file from master to slave:
scp /opt/credentials.yml user@slave_ip:/opt/
- Download and run the script:
wget https://raw.githubusercontent.com/CodonoTeam/cryptocurrency-exchange-script/main/docs/multi_server/multi-server-setup.sh chmod +x multi-server-setup.sh ./multi-server-setup.sh
- Master Server: Primary database server with write capabilities
- Slave Server: Secondary database server for read operations
- Memcached: Distributed session storage across both servers
- Redis: Local caching with password protection
- Load Balancer: Distributes traffic between servers (not included in script)
- All credentials are stored in credentials.yml
- Replication user has restricted access
- SSL is required for database replication
- Redis and Memcached are configured with authentication
- .htaccess protects web directories
- Credentials file has restricted permissions
- Regularly update passwords in credentials.yml
- Monitor database replication status
- Check server health and resource usage
- Update software packages regularly
- Verify network connectivity between servers
- Check MariaDB error logs
- Ensure firewall rules are correctly configured
- Validate credentials in credentials.yml
This script was developed to simplify multi-server environment setup while maintaining security and performance standards.