Beispiel #1
0
        /// <summary>
        /// Starts the node.
        /// </summary>
        /// <param name="options">The configuration options for the node.</param>
        public override void Start(Options options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            this.nodeId = options.NodeId;
            this.plan = options.Plan;
            this.migrationNfs = options.MigrationNFS;
            base.Start(options);
        }
        /// <summary>
        /// Starts the MS SQL Node using the specified arguments.
        /// </summary>
        internal void Start()
        {
            ServiceElement serviceConfig = UhuruSection.GetSection().Service;

            Options options = new Options();
            options.AvailableStorage = serviceConfig.AvailableStorage;
            options.Capacity = serviceConfig.Capacity;
            options.BaseDir = serviceConfig.BaseDir;
            options.Index = serviceConfig.Index;
            options.LocalDB = serviceConfig.LocalDB;
            options.MaxDBSize = serviceConfig.MaxDBSize;
            options.MaxLengthyQuery = serviceConfig.MaxLengthyQuery;
            options.MaxLengthTX = serviceConfig.MaxLengthTX;
            options.MigrationNFS = serviceConfig.MigrationNFS;
            options.NodeId = serviceConfig.NodeId;
            options.Plan = serviceConfig.Plan;
            options.Uri = new System.Uri(serviceConfig.MBus);
            options.ZInterval = serviceConfig.ZInterval;
            options.LocalRoute = serviceConfig.LocalRoute;
            options.StatusPort = serviceConfig.StatusPort;

            MSSqlOptions sqlServerOptions = new MSSqlOptions();
            sqlServerOptions.Host = serviceConfig.MSSql.Host;
            sqlServerOptions.User = serviceConfig.MSSql.User;
            sqlServerOptions.Port = serviceConfig.MSSql.Port;
            sqlServerOptions.Password = serviceConfig.MSSql.Password;
            sqlServerOptions.LogicalStorageUnits = serviceConfig.MSSql.LogicalStorageUnits;

            sqlServerOptions.InitialDataSize = serviceConfig.MSSql.InitialDataSize;
            sqlServerOptions.InitialLogSize = serviceConfig.MSSql.InitialLogSize;

            sqlServerOptions.MaxDataSize = serviceConfig.MSSql.MaxDataSize;
            sqlServerOptions.MaxLogSize = serviceConfig.MSSql.MaxLogSize;

            sqlServerOptions.DataFileGrowth = serviceConfig.MSSql.DataFileGrowth;
            sqlServerOptions.LogFileGrowth = serviceConfig.MSSql.LogFileGrowth;

            this.node = new Node();
            this.node.Start(options, sqlServerOptions);
        }
Beispiel #3
0
        /// <summary>
        /// Starts the node.
        /// </summary>
        /// <param name="options">The configuration options for the node.</param>
        /// <param name="sqlOptions">The MS SQL Server options.</param>
        public void Start(Options options, MSSqlOptions sqlOptions)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (sqlOptions == null)
            {
                throw new ArgumentNullException("sqlOptions");
            }

            this.mssqlConfig = sqlOptions;
            this.maxDbSize = options.MaxDBSize * 1024 * 1024;
            this.maxLongQuery = options.MaxLengthyQuery;
            this.maxLongTx = options.MaxLengthTX;
            this.localIp = NetworkInterface.GetLocalIPAddress(options.LocalRoute);

            this.connection = this.ConnectMSSql();

            TimerHelper.RecurringCall(
                KeepAliveInterval,
                delegate
                {
                    this.KeepAliveMSSql();
                });

            if (this.maxLongQuery > 0)
            {
                TimerHelper.RecurringCall(
                    this.maxLongQuery / 2,
                    delegate
                    {
                        this.KillLongTransactions();
                    });
            }

            if (this.maxLongTx > 0)
            {
                TimerHelper.RecurringCall(
                    this.maxLongTx / 2,
                    delegate
                    {
                        this.KillLongQueries();
                    });
            }
            else
            {
                Logger.Info(Strings.LongTXKillerDisabledInfoMessage);
            }

            TimerHelper.RecurringCall(
                StorageQuotaInterval,
                delegate
                {
                    this.EnforceStorageQuota();
                });

            this.baseDir = options.BaseDir;
            if (!string.IsNullOrEmpty(this.baseDir))
            {
                Directory.CreateDirectory(this.baseDir);
            }

            ProvisionedService.Initialize(options.LocalDB);

            this.CheckDBConsistency();

            this.availableStorageBytes = options.AvailableStorage * 1024 * 1024;
            this.availableCapacity = options.Capacity;

            foreach (ProvisionedService provisioned_service in ProvisionedService.GetInstances())
            {
                this.availableStorageBytes -= this.StorageForService(provisioned_service);
                this.availableCapacity -= this.CapacityUnit();
            }

            this.queriesServed = 0;
            this.qpsLastUpdated = DateTime.Now;

            // initialize qps counter
            this.GetQPS();
            this.longQueriesKilled = 0;
            this.longTxKilled = 0;
            this.provisionServed = 0;
            this.bindingServed = 0;
            this.Start(options);
        }
Beispiel #4
0
 /// <summary>
 /// Starts the node.
 /// </summary>
 /// <param name="options">The configuration options for the node.</param>
 public override void Start(Options options)
 {
     base.Start(options);
 }
        /// <summary>
        /// Starts the service using the specified options.
        /// </summary>
        /// <param name="options">The configuration options.</param>
        public virtual void Start(Options options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            this.localIP = NetworkInterface.GetLocalIPAddress();
            Logger.Info(Strings.InitializingLogMessage, this.ServiceDescription());
            this.OrphanInstancesHash = new Dictionary<string, object>();
            this.OrphanBindingHash = new Dictionary<string, object>();

            this.nodeNats = ReactorFactory.GetReactor(typeof(Reactor));
            this.nodeNats.OnError += new EventHandler<ReactorErrorEventArgs>(this.NatsErrorHandler);
            this.NodeNats.Start(options.Uri);

            this.OnConnectNode();

            this.vcapComponent = new VCAPComponent();

            this.vcapComponent.Register(
                new Dictionary<string, object>
                {
                    { "nats", this.NodeNats },
                    { "type", this.ServiceDescription() },
                    { "host", this.localIP },
                    { "index", options.Index },
                    { "config", options },
                    { "statusPort", options.StatusPort }
                });

            int zInterval = options.ZInterval;

            // give service a chance to wake up
            TimerHelper.DelayedCall(
                5000,
                delegate
                {
                    this.UpdateVarz();
                });

            TimerHelper.RecurringCall(
                zInterval,
                delegate
                {
                    this.UpdateVarz();
                });

            // give service a chance to wake up
            TimerHelper.DelayedCall(
                5000,
                delegate
                {
                    this.UpdateHealthz();
                });

            TimerHelper.RecurringCall(
                zInterval,
                delegate
                {
                    this.UpdateHealthz();
                });
        }