milvus/cmd/datanode/main.go
groot dc3736281a Integrate message stream
Signed-off-by: groot <yihua.mo@zilliz.com>
2021-02-08 14:30:54 +08:00

44 lines
739 B
Go

package main
import (
"context"
"log"
"os"
"os/signal"
"syscall"
distributed "github.com/zilliztech/milvus-distributed/cmd/distributed/components"
"github.com/zilliztech/milvus-distributed/internal/msgstream/pulsarms"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
msFactory := pulsarms.NewFactory()
dn, err := distributed.NewDataNode(ctx, msFactory)
if err != nil {
panic(err)
}
if err = dn.Run(); err != nil {
panic(err)
}
sc := make(chan os.Signal, 1)
signal.Notify(sc,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGQUIT)
sig := <-sc
log.Println("Got signal to exit signal:", sig.String())
err = dn.Stop()
if err != nil {
panic(err)
}
}