Giter Site home page Giter Site logo

automation-cockroach's Introduction

Cockroach DB

Terraform and Ansible projects to set up Cockroach DB environment and monitoring tools.

Prerequisites

  • Python 3
  • Ansible 2.9
  • Terraform v0.13
  • CentOS / RHEL 7.6 or above

Orchestration System

This is the linux system used to invoke Terraform and Ansible in order to create the test environment.

Orchestration System Setup

  1. Install requirements.

    sudo yum -y install python3 python3-pip git wget unzip
    
  2. Install Terraform according to the instructions here

    # Download terraform package
    # Note. The scripts are using features only available in version 0.13+
    wget https://releases.hashicorp.com/terraform/0.13.2/terraform_0.13.2_linux_amd64.zip
    
    # Extract
    unzip terraform_*_linux_amd64.zip
    
    # Install
    sudo mv ./terraform /usr/bin/
    
    # Remove zip file
    rm terraform_*_linux_amd64.zip
    
  3. Clone git repository

    # Change to home directory
    cd ~
    
    # Clone git repository
    git clone https://github.com/cleeistaken/automation-cockroach.git
    
    # Change into git repository
    cd automation-cockroach
    
  4. Create a Python virtual environment.

    # Create virtual environment
    python3 -m venv $HOME/.python3-venv
    
    # Activate the virtual environment
    source $HOME/.python3-venv/bin/activate
    
    # (optional) Add VENV to login script
    echo "source $HOME/.python3-venv/bin/activate" >> $HOME/.bashrc
    
  5. Install required python packages.

    pip install --upgrade pip
    pip install --upgrade setuptools
    pip install -r python-requirements.txt
    

VM Template

We create a template to address the following requirements and limitations.

  1. Need a user account and SSH key for Ansible.
  2. Current Terraform (0.13) cannot add a PTP clock device to a VMware vSphere VM.

VM Template Setup

  1. Create a Linux VM with a distribution and version supported by the VMware PTP driver.
  • Set the VM Hardware compatibility to vSphere 7.0 (HW version 17)
  • Add a Precision Clock device to the VM hardware devices and set the source to Host NTP
  • Disable Secure Boot; this prevents from loading the unsigned ptp modules and will not allow the compiled vmw_ptp driver to taint the kernel.
  1. Install the required packages for the Terraform customization.

    sudo yum install open-vm-tools perl
    
  2. From the orchestration system create and upload a ssh key to the template VM.

    # Check and create a key if none exits
    if [ ! -f ~/.ssh/id_rsa ]; then
      ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N ""
    fi
    
    # Copy to the template VM
    ssh-copy-id root@<ip of the vm>
    
    
  3. In vSphere convert the VM to a template to prevent any changes.

Cockroach Cluster Deployment

Terraform

  1. Initialize Terraform

    # Change to Terraform folder
    cd ~/workload-automation/cockroach/terraform/
    
    # Initialize
    terraform init
    
  2. Configure environment settings

    vi terraform.tfvars
    
  3. Deploy Cockroach environment

    terraform apply
    

Ansible

  1. Check and configure settings

    cd ~/automation-cockroach/ansible/
    vi settings.yml
    vi ansible.cfg
    
  2. Deploy Cockroach DB

    ansible-playbook -i settings.yml -i hosts.yml deploy.yml
    
  3. Run tests

    # YCSB test
    ansible-playbook -i settings.yml -i hosts.yml ycsb-init.yml
    ansible-playbook -i settings.yml -i hosts.yml ycsb-run.yml
    
    # TPCC test
    ansible-playbook -i settings.yml -i hosts.yml tpcc-init.yml
    ansible-playbook -i settings.yml -i hosts.yml tpcc-run.yml
    

automation-cockroach's People

Contributors

cleeistaken avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

automation-cockroach's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.