Awesome
mesos-go-stateful
An abstraction on top of mesos-go for steteful workload
Sample Run
- Download the codegen Package
$go get -v github.com/huawei-cloudfederation/mesos-go-stateful/codegen
github.com/samuel/go-zookeeper (download)
.
.
.
github.com/huawei-cloudfederation/mesos-go-stateful/common/types
github.com/huawei-cloudfederation/mesos-go-stateful/codegen
codegen
utility would have been installed
$codegen -h
Usage of codegen:
-alsologtostderr
log to standard error as well as files
-log_backtrace_at value
when logging hits line file:N, emit a stack trace (default :0)
-log_dir string
If non-empty, write log files in this directory
-logtostderr
log to standard error instead of files
-name string
Name of the scheduler eg: RedisScheduler or MySQLScheduler (default "Example")
-path string
Path where the project needs to be created (default "./")
-stderrthreshold value
logs at or above this threshold go to stderr
-v value
log level for V logs
-vmodule value
comma-separated list of pattern=N settings for file-filtered logging
- Create a Project for MySQL Stateful Framework
codegen -name MySQL -path /home/ubuntu/workdir
I1113 05:19:45.377934 7471 gen.go:129] Creating Sub-directories at /home/ubuntu/workdir/MySQL.....
I1113 05:19:45.378115 7471 gen.go:153] Generating Scheduler.go...
I1113 05:19:45.378363 7471 gen.go:171] Generating autofilled config file
I1113 05:19:45.378545 7471 gen.go:192] Project Generation Completed
- Examine the Project
$~/workdir$ ls -lrt MySQL
drwxrwxr-x 2 ubuntu ubuntu 4096 Nov 13 05:19 Scheduler
|-- -rw-rw-r-- 1 ubuntu ubuntu 1771 Nov 13 05:19 Scheduler.go
drwxrwxr-x 2 ubuntu ubuntu 4096 Nov 13 05:19 Executor
drwxrwxr-x 2 ubuntu ubuntu 4096 Nov 13 05:19 Config
|-- -rw-rw-r-- 1 ubuntu ubuntu 430 Nov 13 05:19 config.json
- Update the auto generated config file
Config/config.json
with your Mesos and etcd/zookeprs endpoint Build the autogenerated Scheduler
$cd /MySQL/Scheduler
$go get -v ./...
$go build Scheduler.go
$./Scheduler
I1113 05:53:29.618408 6816 Scheduler.go:84] Scheduler terminated
I1113 05:53:29.618961 6816 sched.go:35] Configuration file is = {root RedMon 10.11.12.18:5050 /home/ubuntu/RedMon/Executor/RedMonExecutor etcd http://127.0.0.1:2379 stderr 127.0.0.1 5454 5656 {1 100 1 host }}
I1113 05:53:29.618987 6816 sched.go:55] *****************************************************************
I1113 05:53:29.619000 6816 sched.go:56] *********************Starting Scheduler******************
I1113 05:53:29.619024 6816 sched.go:57] *****************************************************************
I1113 05:53:29.699301 6816 sched.go:74] Configuration file is = {root RedMon 127.0.0.1:5050 /home/ubuntu/RedMon/Executor/RedMonExecutor etcd http://127.0.0.1:2379 stderr 127.0.0.1 5454 5656 {1 100 1 host }}
I1113 05:53:29.699465 6816 httplib.go:84] Starting the HTTP server at port 5656
I1113 05:53:29.699550 6816 mesoslib.go:37] Hosting artifact '5454' at 'http://127.0.0.1:5454/5454'
I1113 05:53:29.700086 6816 mesoslib.go:59] hostIP = 127.0.0.1 going to listen and serve
I1113 05:53:29.701431 6816 mesoslib.go:144] framework id is 9a781c1c-4609-47fa-84ff-d3191ad1634a-0067/Workload/Config
I1113 05:53:29.701539 6816 mesoslib.go:151] Delta of the previously registered framework is = 24h36m34.227297928s
2016/11/13 05:53:29 [I] http server Running on http://:5656
I1113 05:53:29.705719 6816 scheduler.go:334] Initializing mesos scheduler driver
I1113 05:53:29.705850 6816 mesoslib.go:209] The Framework ID is &FrameworkID{Value:*,XXX_unrecognized:[],} and &FrameworkID{Value:*,XXX_unrecognized:[],}
I1113 05:53:29.705887 6816 scheduler.go:833] Starting the scheduler driver...
I1113 05:53:29.705939 6816 http_transporter.go:383] listening on 127.0.0.1 port 38371
I1113 05:53:29.706020 6816 scheduler.go:850] Mesos scheduler driver started with PID=scheduler(1)@127.0.0.1:38371
I1113 05:53:29.706048 6816 scheduler.go:1053] Scheduler driver running. Waiting to be stopped.
I1113 05:53:29.726799 6816 scheduler.go:419] New master master@127.0.0.1:5050 detected
I1113 05:53:29.726840 6816 scheduler.go:483] No credentials were provided. Attempting to register scheduler without authentication.
Now a basic framework with HTTP CURD/Mesos communication / KV store is ready