Skip to content

Commit

Permalink
modified: kiteq.go
Browse files Browse the repository at this point in the history
	modified:   server/kite_store_parser.go
	modified:   store/mysql/kite_mysql.go
  • Loading branch information
blackbeans committed Mar 27, 2015
1 parent 78b7bfc commit 4f6421f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kiteq.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func main() {
zkhost := flag.String("zkhost", "localhost:2181", "-zkhost=localhost:2181")
topics := flag.String("topics", "", "-topics=trade,a,b")
db := flag.String("db", "mmap://file=/data/kiteq&initcap=100000&maxcap=200000",
"-db=mysql://master:3306,slave:3306/kite?username=root&password=root&maxConn=500&batchUpdateSize=1000&batchDelSize=1000&flushPeriod=1000")
"-db=mysql://master:3306,slave:3306?db=kite&username=root&password=root&maxConn=500&batchUpdateSize=1000&batchDelSize=1000&flushPeriod=1000")
pprofPort := flag.Int("pport", -1, "pprof port default value is -1 ")

flag.Parse()
Expand Down
1 change: 1 addition & 0 deletions server/kite_store_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func parseDB(db string) store.IKiteStore {
options := smq.MysqlOptions{
Addr: master,
SlaveAddr: slave,
DB: params["db"],
Username: username,
Password: password,
BatchUpSize: bus,
Expand Down
5 changes: 3 additions & 2 deletions store/mysql/kite_mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
type MysqlOptions struct {
Addr string
SlaveAddr string
DB string
Username, Password string
BatchUpSize, BatchDelSize int
FlushPeriod time.Duration
Expand All @@ -35,12 +36,12 @@ type KiteMysqlStore struct {
func NewKiteMysql(options MysqlOptions) *KiteMysqlStore {

master := openDb(
options.Username+":"+options.Password+"@tcp("+options.Addr+")",
options.Username+":"+options.Password+"@tcp("+options.Addr+")/"+options.DB,
options.MaxIdleConn, options.MaxOpenConn)
slave := master
if len(options.SlaveAddr) > 0 {
slave = openDb(
options.Username+":"+options.Password+"@tcp("+options.SlaveAddr+")",
options.Username+":"+options.Password+"@tcp("+options.SlaveAddr+")/"+options.DB,
options.MaxIdleConn, options.MaxOpenConn)
}

Expand Down

0 comments on commit 4f6421f

Please sign in to comment.