Giter Site home page Giter Site logo

mq's Introduction

eaciit-mq

Memory Data Que management developed using GoLang

##Running Server / Node

###Running Node as Master

go run mqd.go

Node will automatically run as server on localhost:7890

###Running Node as Slave

go run mqd.go -master 127.0.0.1:7890 -port 7891

Node will automatically run as slave with master on localhost:7890 Note : slave port must different with master port

###Running Node as Mirror

go run mqd.go -master 127.0.0.1:7890 -port 7892 -mirror

Adding -mirror will run node as mirror Node will automatically run as mirror with master on localhost:7890 Note : mirror port must different with master port

Running Web Monitor

go run mqmonitor.go

Automatically run web server on localhost:1234 and connecting to master node on 127.0.0.1:7890

Running Client

go run mqclient.go

Automatically run client and connecting to RPC Server.

###List client commands

Command Action
exit exit from mqclient
kill kill all nodes and client (webmonitor will still running)
ping show recent status of all nodes (including mirror)
nodes -
gettable -
set(key,value) set value for given key or adding new value with given key if not existed
get(key) get value for given key
inc(parameter) -
getlog(parameter) -
addUser(username,password,role) add new user with given parameters (Only admin can run this command)
updateUser(username,password,role) update registed user's password and role form given username (Only admin can run this command)
deleteUser(username1,username2,...) delete user with given usernames (Only admin can run this command)
changepassword(newPassword) change current password to new password
getlistusers show all username and encrypted password registed
keys(nodenumber) show all available keys on given node
info(key) show detailed info for given key
writetodisk write all available items to node's disk
writetodisk(key1,key2,...) write items for given keys to node's disk
readfromdisk read all available data on all node's disk
readfromdisk(key1,key2,...) Not yet implemented

###Format key,value,nodenumber :

1.  key   -> tablename|key, ex : employees|emp1
2.  value -> json format, ex : {"name":"eaciit","role":"admin"}
3.  nodenumber -> ex : 0

##API

Protocol URI Action
POST /api/gettoken/username={username}&password={password} Return token and valid time with given username and password
GET /api/checktoken/token={token} Return token and time with given token
GET /api/get/token={token}&key={key} Return item with given key
POST /api/put/token={token}&key={key} Set item with given key + form value and return item info

###Get

####Example

Given Parameter

http://localhost:8090/api/get/token=I14jVFA5UFw6LBlRWlswBGA-Lwc7DxhbO1VJNTshKRU=&key=eat

Return Data

{
  "message": "",
  "data": {
    "Created": "0001-01-01T00:00:00Z",
    "Duration": 0,
    "Expiry": 0,
    "Key": "public|eat",
    "Owner": "public",
    "Permission": "666",
    "Size": 8,
    "LastAccess": "2015-06-19T10:26:05.78013317+07:00",
    "Table": "",
    "Value": "sushi"
  },
  "success": true
}

###Put

####Example

Given Parameter

http://localhost:8090/api/put/token=I14jVFA5UFw6LBlRWlswBGA-Lwc7DxhbO1VJNTshKRU=&key=eat

With FormData

"value" = "sushi"

Return Data

{
  "message": "",
  "data": {
    "Node": 0,
    "Owner": "public",
    "Size": 8,
    "Valid": 0
  },
  "success": true
}

mq's People

Contributors

sugab avatar novalagung avatar nbprayuga avatar ekypradhana avatar ariefdarmawan avatar func0207 avatar nandabudi avatar

Watchers

James Cloos avatar  avatar

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.