Giter Club home page Giter Club logo

gcp01's Introduction

gcp01

Google Cloud Terraform project.

It's project which will create Google Cloud MySQL innodb cluster based on Compute Engine. I will use the smallest possible machines and MySQL community version. It's just for self development and training purposes.

As result you may connect to InnoDB cluster using public IP of MySQL router and port 3306 (R/W access) or 3307 (R/O access)

By default there are 3 instances created (1 master and 2 slaves). There is possibility to create up to 9 instances by running: terraform apply -var 'count_instances=...' (for example count_instances=9)

Requirements:

  • Cloud - Google Cloud Platform
  • Compute Engine VM - There is no possibility to use f1-micro without database tuning (maybe it will be next version), as there is not enough memory to run MySQL 8.0 on default settings. Recommended g1-small (1.7 GB RAM)
  • OS - Project is written with using CentOS 8, but it may be modified to any other OS
  • MySQL - MySQL 8.0 modules. In my opinion there may be also version 5.7 used.

Future improvements:

  1. Project may be extended for using containers for MySQL 8.0
  2. Securing all ports
  3. Elimination 'sleep' commands in scripts
  4. Putting passwords into terraform vault
  5. Support more nodes than 9
  6. More clean terraform code
  7. Logging and tracing errors
  8. Output with public IP of MySQL router at the end of terraform deployment

Additional notes:

In case you need change temporary MySQL password after installation, I found nice bash example:

password=$(grep -oP 'temporary password(.*): \K(\S+)' /var/log/mysqld.log)

mysqladmin --user=root --password="$password" password aaBB@@cc1122

mysql --user=root --password=aaBB@@cc1122 -e "UNINSTALL COMPONENT 'file://component_validate_password';"

mysqladmin --user=root --password="aaBB@@cc1122" password ""

Useful commands:

mysqlsh mycluster@mysql01

MySQL Shell:

var cluster = dba.getCluster();
cluster.status();
dba.dropMetadataSchema();
cluster.dissolve({force:true});

MySQL SQL:

select @@port
select @@hostname

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.