Skip to content

Instantly share code, notes, and snippets.

View wwwted's full-sized avatar

Ted Wennmark wwwted

  • Oracle/MySQL
  • Uppsala Sweden
View GitHub Profile
@wwwted
wwwted / mcm.cmds
Last active May 19, 2020 12:28
MCM commands to create cluster
create site --hosts=127.0.0.1 mysite;
add package --basedir=/home/opc/workshop/cluster-7614 cluster7614;
create cluster --package=cluster7614 --processhosts=ndb_mgmd@127.0.0.1,ndbmtd@127.0.0.1,ndbmtd@127.0.0.1 mycluster;
add process --processhosts=mysqld@127.0.0.1,mysqld@127.0.0.1 mycluster;
add process --processhosts=ndbapi@127.0.0.1,ndbapi@127.0.0.1 mycluster;
add process --processhosts=ndbapi@127.0.0.1,ndbapi@127.0.0.1 mycluster;
set port:mysqld:50=3310 mycluster;
set port:mysqld:51=3311 mycluster;
set StopOnError:ndbmtd=0 mycluster;
@wwwted
wwwted / helloREST.c
Created April 24, 2020 11:08
Simple c program that listens to some port and prints "Hello World" as responce
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/*
import mysql.connector
from mysql.connector import errorcode
import time
import sys
conn=None
def add_employee(conn, emp_no, first_name, last_name):
try:
#!/bin/bash
# wget https://dev.mysql.com/get/Downloads/MySQL-Cluster-7.6/mysql-cluster-gpl-7.6.9-linux-glibc2.12-x86_64.tar.gz
# Download MCM by following my guide on Github here: https://github.com/wwwted/ndb-cluster-workshop/blob/master/labs/prework.md
# Download NDB 7.6.9 and MCM 1.4.7 + change BIN_DIR to folder with binaries in tar.gz format.
# TARGET_DIR is where you downloaded the workshop (git clone https://github.com/wwwted/ndb-cluster-workshop.git)
TARGET_DIR="/home/ted/ndb-cluster-workshop"
NDB_BIN="/home/ted/src/mysql-cluster-gpl-7.6.9-linux-glibc2.12-x86_64.tar.gz"
MCM_BIN="/home/ted/src/mcm-1.4.7-linux-glibc2.12-x86-64bit.tar.gz"
#!/opt/csw/bin/perl
use DBI;
my $host="192.168.1.233";
my $port="3306";
my $user="ted";
my $pwd="ted";
my $wait;
my @dbhs;
4 Screens : watch "pgrep -fla mysql | grep -v pgrep"
watch ./count.sh
. ./setenv
(to get correct path to binaries)
Create InnoDB cluster
======================
./shell/bin/mysqlsh < scripts/deploy.js
./shell/bin/mysqlsh -uroot -proot -h127.0.0.1 -P3310 < scripts/persist-config.js
List help:
mcm> list commands;
Stop cluster:
mcm> stop cluster mycluster;
Start cluster:
mcm> start cluster mycluster;
@wwwted
wwwted / create_ndb_testdata.sql
Last active February 23, 2018 13:41
Simple table with some NDB testdata
drop database IF EXISTS ted;
create database ted;
use ted;
create table test (
id int primary key auto_increment,
name varchar(32),
address varchar(32),
age int,
@wwwted
wwwted / README.md
Created February 22, 2018 15:24 — forked from hofmannsven/README.md
My simply Git Cheatsheet