2020-10-15 21:31:50 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-11-11 09:54:01 +08:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
2020-11-04 16:28:14 +08:00
|
|
|
|
2020-11-26 16:01:31 +08:00
|
|
|
"github.com/zilliztech/milvus-distributed/internal/querynode"
|
2020-10-15 21:31:50 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-11-11 09:54:01 +08:00
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
2020-11-12 12:04:12 +08:00
|
|
|
defer cancel()
|
|
|
|
|
2020-11-26 16:01:31 +08:00
|
|
|
querynode.Init()
|
2020-10-15 21:31:50 +08:00
|
|
|
|
2020-11-11 09:54:01 +08:00
|
|
|
sc := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(sc,
|
|
|
|
syscall.SIGHUP,
|
|
|
|
syscall.SIGINT,
|
|
|
|
syscall.SIGTERM,
|
|
|
|
syscall.SIGQUIT)
|
|
|
|
|
|
|
|
var sig os.Signal
|
|
|
|
go func() {
|
|
|
|
sig = <-sc
|
|
|
|
cancel()
|
|
|
|
}()
|
2020-11-17 20:00:23 +08:00
|
|
|
|
2020-11-26 16:01:31 +08:00
|
|
|
querynode.StartQueryNode(ctx)
|
2020-11-11 09:54:01 +08:00
|
|
|
|
|
|
|
switch sig {
|
|
|
|
case syscall.SIGTERM:
|
|
|
|
exit(0)
|
|
|
|
default:
|
|
|
|
exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func exit(code int) {
|
|
|
|
os.Exit(code)
|
2020-10-15 21:31:50 +08:00
|
|
|
}
|