func StartControllerService() {
	serviceName := common.ControllerServiceName
	cfg := common.SetupServerConfig(configure.NewCommonConfigure())
	svcCfg := cfg.GetServiceConfig(serviceName)
	if e := os.Setenv("port", fmt.Sprintf("%d", svcCfg.GetPort())); e != nil {
		logrus.Panic(e)
	}
	hostID := uuid.New()
	deploymentName := svcCfg.GetDeploymentName()
	log := svcCfg.GetLogger().WithFields(bark.Fields{
		common.TagCtrl:    common.FmtCtrl(hostID),
		common.TagDplName: common.FmtDplName(deploymentName),
	})
	meta, err := metadata.NewCassandraMetadataService(cfg.GetMetadataConfig(), log)
	if err != nil {
		log.WithField(common.TagErr, err).Fatal(`unable to instantiate metadata service (did you run ./scripts/setup_cassandra_schema.sh?)`)
	}
	hwInfoReader := common.NewHostHardwareInfoReader(meta)
	reporter := common.NewMetricReporterWithHostname(svcCfg)
	dClient := dconfigclient.NewDconfigClient(svcCfg, serviceName)
	sVice := common.NewService(serviceName, hostID, svcCfg, common.NewUUIDResolver(meta), hwInfoReader, reporter, dClient, common.NewBypassAuthManager())
	mcp, tc := controllerhost.NewController(cfg, sVice, meta, common.NewDummyZoneFailoverManager())
	mcp.Start(tc)
	common.ServiceLoop(svcCfg.GetPort()+diagnosticPortOffset, cfg, mcp.Service)
}
StartControllerService starts the controller service of cherami
package servicecmd
import (
	"flag"
	"fmt"
	"os"
	"strings"
	"github.com/sirupsen/logrus"
	"github.com/uber-common/bark"
	"github.com/uber/cherami-server/clients/metadata"
	"github.com/uber/cherami-server/common"
	"github.com/uber/cherami-server/common/configure"
	"github.com/uber/cherami-server/common/dconfigclient"
	"github.com/uber/cherami-server/services/controllerhost"
	"github.com/uber/cherami-server/services/frontendhost"
	"github.com/uber/cherami-server/services/inputhost"
	"github.com/uber/cherami-server/services/outputhost"
	"github.com/uber/cherami-server/services/replicator"
	"github.com/uber/cherami-server/services/storehost"
	m "github.com/uber/cherami-thrift/.generated/go/metadata"
	"github.com/pborman/uuid"
	_ "net/http/pprof"  
)
const (
	diagnosticPortOffset = 10000
)
func StartInputHostService() {
	serviceName := common.InputServiceName
	cfg := common.SetupServerConfig(configure.NewCommonConfigure())
	svcCfg := cfg.GetServiceConfig(serviceName)
	if e := os.Setenv("port", fmt.Sprintf("%d", svcCfg.GetPort())); e != nil {
		logrus.Panic(e)
	}
	hostID := uuid.New()
	deploymentName := svcCfg.GetDeploymentName()
	log := svcCfg.GetLogger().WithFields(bark.Fields{
		common.TagIn:      common.FmtIn(hostID),
		common.TagDplName: common.FmtDplName(deploymentName),
	})
	meta, err := metadata.NewCassandraMetadataService(cfg.GetMetadataConfig(), log)
	if err != nil {
		log.WithField(common.TagErr, err).Fatal(`inputhost: unable to instantiate metadata client`)
	}
	hwInfoReader := common.NewHostHardwareInfoReader(meta)
	reporter := common.NewMetricReporterWithHostname(svcCfg)
	dClient := dconfigclient.NewDconfigClient(svcCfg, serviceName)
	sCommon := common.NewService(serviceName, hostID, svcCfg, common.NewUUIDResolver(meta), hwInfoReader, reporter, dClient, common.NewBypassAuthManager())
	h, tc := inputhost.NewInputHost(serviceName, sCommon, meta, nil)
	h.Start(tc)
	common.WSStart(svcCfg.GetListenAddress().String(),
		svcCfg.GetWebsocketPort(), h)
	common.ServiceLoop(svcCfg.GetPort()+diagnosticPortOffset, cfg, h)
}