Using MariaDB with SlapOS
Agenda
- Request a MySQL instance
- Setup stunnel
- Connect to SQL
Requirements
Your node has to be able to create new instances of MariaDB (see previous tutorials).
You first need to install MariaDB Software Release on your node.
Once the Software Release is installed, your node is ready to deploy instances of MariaDB.
Note: Please make sure to remember the version of MariaDB Software Release you installed. Only instance from the installed version(s) can be created on this node.
Request
In the previous tutorials you saw how to request instance.
Choose the method your prefer to request a "MariaDB" instance on your own Node.
The most simple way to request an instance is to go on vifib.net and request a service on your own node.
Configure stunnel
Install, (re)configure and launch stunner and mysql-client to connect to your instance :
# apt-get install stunnel mysql-client
$ mkdir ~/slapos
$ echo "foreground = yes
syslog = no
pid = /home/$(whoami)/slapos/stunnel.pid
debug = debug
[service]
accept = 127.0.0.1:12345
connect = REPLACE_ME_BY_YOUR_STUNNEL_IP:REPLACE_ME_BY_YOUR_STUNNEL_PORT
client = yes" > /home/$(whoami)/slapos/stunnel.conf
$ stunnel4 /home/$(whoami)/slapos/stunnel.conf
Install stunnel on your machine (on debian, do apt-get install stunnel). Then configure it, and launch it.
Install MySQL client (on Debian, do apt-get install mysql-client).
Note: It Doesn't have to be on same machine that your node!
Connect to Mysql
mysql -u user -h 127.0.0.1 -P 3306 -p db
Connect to your instance using mysql client utility.
Learn how to create your own service.