cluster support

This commit is contained in:
Cloud Wu
2014-05-22 21:04:32 +08:00
parent 90cd967333
commit 88700c2c90
11 changed files with 357 additions and 3 deletions

8
examples/cluster1.lua Normal file
View File

@@ -0,0 +1,8 @@
local skynet = require "skynet"
local cluster = require "cluster"
skynet.start(function()
skynet.newservice("simpledb")
skynet.call("SIMPLEDB", "lua", "SET", "a", "foobar")
cluster.open(2528)
end)

6
examples/cluster2.lua Normal file
View File

@@ -0,0 +1,6 @@
local skynet = require "skynet"
local cluster = require "cluster"
skynet.start(function()
print(cluster.call("db", "SIMPLEDB", "GET", "a"))
end)

1
examples/clustername.lua Normal file
View File

@@ -0,0 +1 @@
db = "127.0.0.1:2528"

12
examples/config.c1 Normal file
View File

@@ -0,0 +1,12 @@
thread = 8
logger = nil
harbor = 1
address = "127.0.0.1:2526"
master = "127.0.0.1:2013"
start = "cluster1"
bootstrap = "snlua bootstrap" -- The service for bootstrap
standalone = "0.0.0.0:2013"
luaservice = "./service/?.lua;./test/?.lua;./examples/?.lua"
lualoader = "lualib/loader.lua"
cpath = "./cservice/?.so"
cluster = "./examples/clustername.lua"

12
examples/config.c2 Normal file
View File

@@ -0,0 +1,12 @@
thread = 8
logger = nil
harbor = 1
address = "127.0.0.1:2527"
master = "127.0.0.1:2014"
start = "cluster2"
bootstrap = "snlua bootstrap" -- The service for bootstrap
standalone = "0.0.0.0:2014"
luaservice = "./service/?.lua;./test/?.lua;./examples/?.lua"
lualoader = "lualib/loader.lua"
cpath = "./cservice/?.so"
cluster = "./examples/clustername.lua"