mariadb 10.2 BETA written from here
INITIAL:
sudo yum —assumeyes update ;
sudo yum —assumeyes group install “Development Tools” ;
sudo yum —assumeyes install git wget curl ;
###########sudo yum —assumeyes install gcc gcc-c++ ;
NODE:
sudo -i ;
curl —silent —location https://rpm.nodesource.com/setup_7.x | bash – ;
yum —assumeyes install nodejs ;
which node ;
node —version ;
APACHE:
sudo yum —assumeyes install httpd ;
sudo systemctl start httpd.service ;
sudo systemctl enable httpd.service ;
MARIADB:
cat <
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
END
yum —assumeyes install MariaDB-server MariaDB-client ;
mysql_install_db —user=mysql —basedir=/usr —datadir=/var/lib/mysql ;
systemctl start mariadb ;
systemctl enable mariadb ; ## optional !
mysql ; ## notice version number !
CREATE USER ‘john’@‘localhost’ IDENTIFIED BY ‘123’ ;
GRANT ALL ON . to ‘john’@‘localhost’
IDENTIFIED BY ‘123’ with max_queries_per_hour 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0
MAX_USER_CONNECTIONS 0;
CREATE DATABASE IF NOT EXISTS deepstream ;
GRANT ALL PRIVILEGES ON `deepstream`.* TO ‘john’@‘localhost’ ;
EXIT
mysql —user=john -p123 deepstream ;
DEEPSTREAM:
sudo wget https://bintray.com/deepstreamio/rpm/rpm -O /etc/yum.repos.d/bintray-deepstreamio-rpm.repo ;
sudo yum install —assumeyes deepstream.io ;
which deepstream;
deepstream —version ;
DEEPSTREAM-MARIADB CONNECTOR:
MANUALLY INSTALL plugin at /etc/deepstream/config.yml !
plugins:
storage:
name: deepstream.io-storage-mariadb
options:
ds_host: ‘localhost’
ds_user: ‘john’
ds_password: ‘123’
ds_databaseName: ‘deepstream’
ds_tableName: ‘deepstream_storage’
ds_keyType: ‘text’
ds_valueType: ‘text’
ds_splitter: ‘/’
(log out of root!)
mkdir server; cd server;
npm init;
npm install —save uws ; ## not sure if this is needed??
npm install —save deepstream.io ;
npm install —save deepstream.io-client-js ;
npm install —save perimetral/deepstream.io-storage-mariadb ; ## may be replaced
npm install —save dyncol ; ## only for blob/binary usage
npm install —save sequelize ; ## only for blob/binary usage
server.js:
cat <
let ds = require(‘deepstream.io’);
let connector = require(‘deepstream.io-storage-mariadb’);
//let server = new Deepstream(); ### BAD – typo in instructions !
let server = new ds();
server.set(‘storage’, new connector({
mariasql: {
host: ’127.0.0.1’,
user: ‘john’,
password: ‘123’,
db: ‘deepstream’,
},
table: {
name: ‘deepstream_storage’,
keyType: ‘text’,
valueType: ‘text’,
},
splitter: ‘/’,
}));
server.start() ;
END
node server.js ;
===================
example.js
mkdir ~/example; cd ~/example ;
npm init; ## answer questions
npm install —save deepstream.io-client-js ;
cat <
const deepstream = require(‘deepstream.io-client-js’) ;
const util = require(‘util’) ;
const dsIpPort = ‘localhost:6020’ ;
const client = deepstream(dsIpPort).login() ;
var record = client.record.getRecord(‘Another-New-Record-Name’);
var testJson = { ‘newTestJson’ : [ { ‘firstKey’ : ‘this is my first key’ , ‘secondKey’ : ‘this is my second key’ } , { ‘thirdKey’ : ‘this is my third key’ , ‘fourthKey’ : ‘this is my fourth key’ } ] } ;
console.log(util.inspect(testJson));
record.whenReady( () => { // ? ? ? ? ? ?
record.set(‘myTestJsonValue’, {x:2} );
//record.set(‘firstname’, ‘this is a test value’ );
//record.set(‘myTestJsonValue’, testJson );
});
END
node example.js ;
#######deepstream install storage mariadb ;
- ln -s
- /var/lib/deepstream/deepstream.io-storage-mariadb/src/connector.js
- /var/lib/deepstream/deepstream.io-storage-deepstream.io-storage-mariadb ;
https://www.npmjs.com/package/deepstream.io-storage-mariadb
===
##git clone https://github.com/perimetral/deepstream.io-storage-mariadb
- ?? ln -s /root/node_modules/deepstream.io-storage-cockroachdb/src/connector.js