Exemple #1
0
        static void Main(string[] args)
        {
            Console.Title = "Silo";
            try
            {
                using (var siloHost = new SiloHost(Console.Title))
                {
                    siloHost.ConfigFileName = "OrleansConfiguration.xml";
                    siloHost.LoadOrleansConfig();

                    siloHost.InitializeOrleansSilo();
                    var startedOk = siloHost.StartOrleansSilo();
                    Console.WriteLine("Silo started successfully");

                    Console.WriteLine("Press enter to exit...");
                    Console.ReadLine();
                    siloHost.ShutdownOrleansSilo();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.ReadLine();
        }
Exemple #2
0
        public OrleansHostWrapper(ClusterConfiguration config, string[] args)
        {
            var siloArgs = SiloArgs.ParseArguments(args);

            if (siloArgs == null)
            {
                return;
            }

            if (siloArgs.DeploymentId != null)
            {
                config.Globals.DeploymentId = siloArgs.DeploymentId;
            }

            _siloHost = new SiloHost(siloArgs.SiloName, config);

            _siloHost.LoadOrleansConfig();

            // todo: use xml config instead.
            var props = new Dictionary <string, string>
            {
                ["Database"]         = "orleanssandbox",
                ["ConnectionString"] = "enter your mongoDB connection string here"
            };

            config.Globals.RegisterStorageProvider <MongoDbStorageProvider>("MongoDBStorage", props);
        }
Exemple #3
0
        private static void Main()
        {
            while (true)
            {
                Console.WriteLine("请输入配置文件名称:");
                var configName = Console.ReadLine();
                var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                           $"{Path.GetFileNameWithoutExtension(configName)}.xml"));
                if (!configFile.Exists)
                {
                    Console.WriteLine($"配置文件:{configFile.FullName},不存在!");
                    continue;
                }
                Console.WriteLine("请输入节点名称:");
                var nodeName = Console.ReadLine() ?? string.Empty;
                using (var host = new SiloHost(nodeName, configFile))
                {
                    host.LoadOrleansConfig();
                    host.InitializeOrleansSilo();
                    host.StartOrleansSilo();

                    Console.WriteLine("已启动,按下任意键退出。");
                    Console.ReadLine();

                    host.StopOrleansSilo();
                }
                break;
            }
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Console.Title = "ClusterSilo3";
            try
            {
                using (var silo = new SiloHost(Console.Title))
                {
                    silo.ConfigFileName = "OrleansConfiguration.config";

                    silo.LoadOrleansConfig();

                    silo.InitializeOrleansSilo();

                    silo.StartOrleansSilo();

                    Console.WriteLine("Silo start successfully");
                    Console.WriteLine("Press any key to exit");

                    Console.ReadLine();

                    silo.ShutdownOrleansSilo();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");
            }
            Console.ReadLine();
        }
Exemple #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please input number:");
            var number = Console.ReadLine();

            Console.Title = "Silo" + number;
            try
            {
                using (var siloHost = new SiloHost(Console.Title))
                {
                    siloHost.ConfigFileName = "OrleansConfiguration" + number + ".xml";;
                    siloHost.LoadOrleansConfig();

                    //siloHost.Config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.Custom;
                    //siloHost.Config.Globals.MembershipTableAssembly = "OrleansConsulUtils";
                    //siloHost.Config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.Disabled;

                    siloHost.InitializeOrleansSilo();
                    var startedOk = siloHost.StartOrleansSilo();
                    Console.WriteLine("Silo started successfully");

                    Console.WriteLine("Press enter to exit...");
                    Console.ReadLine();
                    siloHost.ShutdownOrleansSilo();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.ReadLine();
        }
Exemple #6
0
        static void Main(string[] args)
        {
            var m_SiloConfigFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{Path.GetFileNameWithoutExtension("OrleansConfiguration")}.xml"));

            using (var m_Host = new SiloHost("GrLionSilo", m_SiloConfigFile))
            {
                m_Host.Config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.ReminderTableGrain;
                m_Host.LoadOrleansConfig();
                m_Host.InitializeOrleansSilo();

                m_Host.StartOrleansSilo();

                ConsoleKeyInfo m_ConsoleKeyInfo = new ConsoleKeyInfo();

                while (m_ConsoleKeyInfo.Key != ConsoleKey.Escape)
                {
                    Console.WriteLine("OrleansSilo已启动,按下'Esc'键结束服务.");
                    m_ConsoleKeyInfo = Console.ReadKey();
                    Console.WriteLine($"{ m_ConsoleKeyInfo.Key}");
                }

                Console.WriteLine("正在结束OrleansSilo服务 . . .");

                m_Host.StopOrleansSilo();
            }
        }
        static void Main(string[] args)
        {
            using (var db = new DBContext())
            {
                Database.SetInitializer <DBContext>(null);
                var objectContext     = ((IObjectContextAdapter)db).ObjectContext;
                var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace);
                mappingCollection.GenerateViews(new List <EdmSchemaError>());
                db.Database.Log = Console.WriteLine;
                db.Database.Initialize(false);
            }

            using (var host = new SiloHost("Default"))
            {
                //host.ConfigFileName = "OrleansConfiguration.xml";
                host.LoadOrleansConfig();
                host.InitializeOrleansSilo();
                host.StartOrleansSilo();
                #region 正式环境

                #endregion
                Console.WriteLine("启动成功");
                Console.Read();
            }
        }
        public void Init()
        {
            var configFileName = "OrleansConfigurationForTesting.xml";
            var siloName       = Dns.GetHostName();       // Default to machine name

            siloHost = new SiloHost(siloName);
            siloHost.ConfigFileName = configFileName;
            siloHost.LoadOrleansConfig();
        }
Exemple #9
0
        internal void Start()
        {
            host.LoadOrleansConfig();
            host.InitializeOrleansSilo();

            if (!host.StartOrleansSilo()) // weird decision made by Orleans team (what about fail fast?)
            {
                throw new Exception("Silo failed to start. Check the logs");
            }
        }
 public bool Start()
 {
     host.LoadOrleansConfig();
     host.InitializeOrleansSilo();
     startup = Task.Factory.StartNew(() =>
     {
         return(host.StartOrleansSilo());
     });
     return(true);
 }
Exemple #11
0
        public static void Main(string[] args)
        {
            var config   = BuildAzureClusterConfig();
            var siloHost = new SiloHost(Dns.GetHostName(), config);

            siloHost.LoadOrleansConfig();

            siloHost.InitializeOrleansSilo();
            siloHost.StartOrleansSilo(false);

            Thread.Sleep(Timeout.Infinite);
        }
Exemple #12
0
        static void InitSilo(string[] args)
        {
            siloHost = new SiloHost(Dns.GetHostName());
            siloHost.LoadOrleansConfig();

            siloHost.InitializeOrleansSilo();
            var startedok = siloHost.StartOrleansSilo();

            if (!startedok)
            {
                throw new SystemException(String.Format("Failed to start Orleans silo '{0}' as a {1} node", siloHost.Name, siloHost.Type));
            }
        }
Exemple #13
0
        static void Main(string[] args)
        {
            using (var host = new SiloHost("Default"))
            {
                host.ConfigFileName = "OrleansConfiguration.xml";
                host.LoadOrleansConfig();
                host.InitializeOrleansSilo();
                host.StartOrleansSilo();

                Console.WriteLine("启动成功");
                Console.Read();
            }
        }
        public SiloRunResult Run()
        {
            bool started = false;

            try
            {
                _silo.LoadOrleansConfig();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                return(new SiloRunResult {
                    status = SiloRunStatus.Error
                });
            }

            try
            {
                _silo.InitializeOrleansSilo();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                return(new SiloRunResult {
                    status = SiloRunStatus.Error
                });
            }

            try
            {
                started = _silo.StartOrleansSilo();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                return(new SiloRunResult {
                    status = SiloRunStatus.Error
                });
            }

            if (!started)
            {
                return(new SiloRunResult {
                    status = SiloRunStatus.Error
                });
            }

            return(new SiloRunResult {
                status = SiloRunStatus.Ready
            });
        }
Exemple #15
0
        private static void Main(string[] args)
        {
            using (var host = new SiloHost("Default"))
            {
                host.LoadOrleansConfig();
                host.InitializeOrleansSilo();
                host.StartOrleansSilo();

                Console.WriteLine("已启动,按下任意键退出。");
                Console.ReadLine();

                host.StopOrleansSilo();
            }
        }
Exemple #16
0
        static void Main(string[] args)
        {
            using (var host = new SiloHost("Default"))
            {
                host.LoadOrleansConfig();
                host.InitializeOrleansSilo();
                host.StartOrleansSilo();

                Console.WriteLine("Press any key to exit.");
                Console.ReadKey(true);

                host.StopOrleansSilo();
            }
        }
Exemple #17
0
        public static void Main(string[] args)
        {
            var silo = new SiloHost(Dns.GetHostName() + "@" + args[0]);

            silo.LoadOrleansConfig();
            silo.InitializeOrleansSilo();
            var success = silo.StartOrleansSilo();

            if (!success)
            {
                throw new Exception("Failed to start silo");
            }

            Console.WriteLine("====>> Host started successfully.");
            Console.ReadLine();
        }
        public OrleansHostWrapper(ClusterConfiguration config, string[] args)
        {
            var siloArgs = SiloArgs.ParseArguments(args);

            if (siloArgs == null)
            {
                return;
            }

            if (siloArgs.DeploymentId != null)
            {
                config.Globals.DeploymentId = siloArgs.DeploymentId;
            }

            siloHost = new SiloHost(siloArgs.SiloName, config);
            siloHost.LoadOrleansConfig();
        }
Exemple #19
0
        internal ClusterActorSystem(ClusterConfiguration configuration, Action <IServiceCollection> di, ActorInvocationPipeline pipeline, IActorRefInvoker invoker)
            : base(invoker)
        {
            this.di  = di;
            Pipeline = pipeline;

            current = this;
            configuration.UseStartupType <Startup>();

            using (Trace.Execution("Orleans silo initialization"))
            {
                Host = new SiloHost(Dns.GetHostName(), configuration);
                Host.LoadOrleansConfig();
                Host.InitializeOrleansSilo();
            }

            Silo = Host.GetSilo();
            Initialize(Silo.GetServiceProvider());
        }
Exemple #20
0
        static void Main(string[] args)
        {
            var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "OrleansConfiguration.xml"));

            Console.Write("输入节点名称:");
            var nodeName = Console.ReadLine() ?? string.Empty;

            using (var host = new SiloHost(nodeName, configFile))
            {
                host.LoadOrleansConfig();
                host.InitializeOrleansSilo();
                host.StartOrleansSilo();

                Console.WriteLine("Press any keys to exit.");
                Console.ReadKey();

                host.StopOrleansSilo();
            }
        }
Exemple #21
0
        private static void InitSilo(string[] args)
        {
            var configFile = Path.Combine(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location), "OrleansConfiguration.xml");

            _host = new SiloHost(Dns.GetHostName())
            {
                ConfigFileName = configFile
            };
            _host.LoadOrleansConfig();
            _host.InitializeOrleansSilo();
            if (_host.StartOrleansSilo())
            {
                Console.WriteLine($"Started host {_host.Name} as a {_host.Type} node");
            }
            else
            {
                Console.WriteLine($"Failed to start host {_host.Name}");
            }
        }
Exemple #22
0
        static void Main(string[] args)
        {
            Console.Title = "SiloHost";
            try
            {
                using (var siloHost = new SiloHost(Console.Title))
                {
                    siloHost.LoadOrleansConfig();
                    siloHost.InitializeOrleansSilo();
                    var starteOk = siloHost.StartOrleansSilo();

                    //检查一下
                    if (siloHost.IsStarted)
                    {
                        Console.WriteLine("Silo started successfully");
                    }
                    else
                    {
                        Console.WriteLine("启动失败");
                    }

                    Console.WriteLine("Press enter to exit...");
                    Console.ReadLine();

                    // 关闭
                    siloHost.StopOrleansSilo();
                    siloHost.UnInitializeOrleansSilo();
                    siloHost.ShutdownOrleansSilo();
                }
            }catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.ReadKey();
        }
 private void Init()
 {
     siloHost.LoadOrleansConfig();
 }
 public OrleansHostWrapper(ClusterConfiguration config)
 {
     siloHost = new SiloHost(Dns.GetHostName(), config);
     siloHost.LoadOrleansConfig();
 }
 internal void Start()
 {
     host.LoadOrleansConfig();
     host.InitializeOrleansSilo();
     host.StartOrleansSilo();
 }