Browse Source

修改beanch

pull/80/head
lixiaoshuang 4 years ago
parent
commit
ee6c5b7ca5
  1. 3
      app/main.go
  2. 2
      bench/http.go
  3. 29
      bench/main.go
  4. 2
      conf.sample.yml

3
app/main.go

@ -11,7 +11,6 @@ import (
"os" "os"
"strings" "strings"
"github.com/yedf/dtm/bench"
"github.com/yedf/dtm/common" "github.com/yedf/dtm/common"
"github.com/yedf/dtm/dtmcli" "github.com/yedf/dtm/dtmcli"
"github.com/yedf/dtm/dtmcli/dtmimp" "github.com/yedf/dtm/dtmcli/dtmimp"
@ -66,8 +65,6 @@ func main() {
// quick_start 比较独立,单独作为一个例子运行,方便新人上手 // quick_start 比较独立,单独作为一个例子运行,方便新人上手
examples.QsStartSvr() examples.QsStartSvr()
examples.QsFireRequest() examples.QsFireRequest()
case "bench":
bench.StartSvr()
case "dev", "dtmsvr": case "dev", "dtmsvr":
default: default:
// 下面是各类的例子 // 下面是各类的例子

2
bench/http.go

@ -4,7 +4,7 @@
* license that can be found in the LICENSE file. * license that can be found in the LICENSE file.
*/ */
package bench package main
import ( import (
"database/sql" "database/sql"

29
bench/main.go

@ -0,0 +1,29 @@
package main
import (
"fmt"
"github.com/yedf/dtm/common"
"github.com/yedf/dtm/dtmcli"
"github.com/yedf/dtm/dtmcli/dtmimp"
"github.com/yedf/dtm/dtmsvr"
"github.com/yedf/dtm/examples"
"os"
)
func main() {
if len(os.Args) > 1 {
dtmimp.Logf("starting dtm....")
if os.Args[1] == "http" {
fmt.Println("start bench server")
common.MustLoadConfig()
dtmcli.SetCurrentDBType(common.DtmConfig.DB["driver"])
common.WaitDBUp()
dtmsvr.PopulateDB(true)
examples.PopulateDB(true)
dtmsvr.StartSvr() // 启动dtmsvr的api服务
go dtmsvr.CronExpiredTrans(-1) // 启动dtmsvr的定时过期查询
StartSvr()
select {}
}
}
}

2
conf.sample.yml

@ -2,7 +2,7 @@ DB:
driver: 'mysql' driver: 'mysql'
host: 'localhost' host: 'localhost'
user: 'root' user: 'root'
password: '' password: '12345678'
port: '3306' port: '3306'
# driver: 'postgres' # driver: 'postgres'

Loading…
Cancel
Save