Slide thumbnail

Massivt batteri på hela 5000 mAh.

Anta utmaningen - Rugtel X10

Slide thumbnail

Rugtel X10 - tåls att ha med!

canada goose jacka i malmö dam

PoC. Användning av Group Communication System (Isis2) för att förbättra MySQL HA replikering
using System; använder System.Text; använder System, köpa Canada Goose Mystique Parka svart dam .Net; använder System.Net.Sockets; använder System.Threading; använder Isis; använder System.Collections.Generic; använder systemet.Linq; namespace IsisMySQLConnector {[AutoMarshalled] MySQLServer de classe {isis_daemon public string; hôte offentliga string; port offentliga string; le statut de chaîne publique; rôle de chaîne publique; TTL public int; last_update offentliga string; MySQLServer publique () {} de MySQLServer publique (Chaîne de demon. Chaîne h. La Chaîne p. Chaîne er ro de Chaîne. Chaîne fram till denna dag) {isis_daemon = démon; värd = H; port = p; status = st; roll = ro; ttl = 30; last_update = fram till denna; }} Déléguer RemoteRegisterMySQLServer vide (Chaîne demon. Chaîne hôte. le port de Chaîne. le statut de Chaîne. le roll de Chaîne. la last_update); déléguer RemoteUnregisterMySQLServer vide (Chaîne demon. Chaîne hôte. le port de Chaîne); déléguer RemoteExpireMySQLServer vide (Chaîne demon. Chaîne hôte. le port de Chaîne); déléguer RemoteHeartbeat vide (Chaîne demon. Chaîne hôte. le port de Chaîne. le statut de Chaîne. int ttl. Chaîne last_update); déléguer RemoteViewChange void (Voir vol); déléguer LoadMySQLServersCheckpoint void (Liste <> MySQLServer de mysqlServers); classe GroupConnector {skyddsling Isis.Timeout Myto = ny Isis.Timeout (10000. Isis.Timeout.TO_FAILURE); protégée EOLMarker myEOL = ny EOLMarker (); protégée int UPDATE_MYSQL_REGISTER = 1; protégée int UPDATE_MYSQL_UNREGISTER = 2; protégée int UPDATE_MYSQL_HEARTBEAT = 3; protégée int UPDATE_MYSQL_EXPIRE = 4; protégée chaîne isis_group; bool skyddsling connecté = false; Groupe MyGroup protegé; Objet thisLock privé = new Object (); Liste protégée mysqlServers = new List (); interne oktett de const MYSQL_SERVER_TID = 123; GroupConnector publique (groupe sträng) {isis_group = groupe; Thread.CurrentThread.Name = "GroupConnector huvudman" + isis_group; IsisSystem.Start (); Msg.RegisterType (typeof (MySQLServer). MYSQL_SERVER_TID); } ~ GroupConnector () {IsisSystem.Shutdown (); } Public void Connect () {if (connecté) {kasta nytt Exception ("Déjà connecté."); } = MyGroup nouveau groupe (isis_group); myGroup.Handlers [UPDATE_MYSQL_REGISTER] + = (RemoteRegisterMySQLServer) RemoteRegisterMySQLServer; myGroup.Handlers [UPDATE_MYSQL_UNREGISTER] + = (RemoteUnregisterMySQLServer) RemoteUnregisterMySQLServer; myGroup.Handlers [UPDATE_MYSQL_HEARTBEAT] + = (RemoteHeartbeat) RemoteHeartbeat; myGroup.Handlers [UPDATE_MYSQL_EXPIRE] + = (RemoteExpireMySQLServer) RemoteExpireMySQLServer; myGroup.ViewHandlers + = (Isis.ViewHandler) RemoteViewChange; myGroup.MakeChkpt + = (Isis.ChkptMaker) Délégué (Voir nv) {verrouillage (thisLock) {if (mysqlServers.Count> 0) {Console.WriteLine ("Överföra stat monteringskomponent"); myGroup.SendChkpt (mysqlServers); MyGroup.EndOfChkpt} (); }}; myGroup.LoadChkpt + = (LoadMySQLServersCheckpoint) delegat (List initialMySQLServers) {lås (thisLock) {foreach (MySQLServer server i initialMySQLServers) {mysqlServers.Add (server); Console.WriteLine ("[GroupConnector] [överföringsstatus] mottagna. {0} - {1} - {2} - {3} - {4} - {5}". server.isis_daemon. server.host . server.port. server.role äkta canada goose jacka i malmö dam . server.status. server canada goose jacka i malmö dam .ttl) }}}; myGroup.Join (); ansluten = true; } Void Skyddad RemoteViewChange (Se v) {if (v.leavers.Length> 0) {Console.WriteLine ("[GroupConnector] [Se Ändra] [{0}] Deamon löv" canada goose jacka i malmö dam sweden . Thread.CurrentThread.Name) Gäng t = new Thread (delegat () {lås (thisLock) {int idx. foreach (Isis.Address i v.leavers) {while ((idx = mysqlServers.FindIndex (delegat (MySQLServer server) {return server.isis_daemon = leaver canada goose jacka i malmö dam .ToString = ();})) = -1) {server = MySQLServer mysqlServers [IDX]; Console.WriteLine ("[GroupConnector] [se förändring] [{0}] ta bort server {1} - {2 } - {3} - {4} - {5} - {6} "Thread.CurrentThread.Name. server.isis_daemon. server.host. server.port. server.role. server.status. server.ttl) ; mysqlServers .RemoveAt (IDX);}}}}); t.Name = "GroupConnector ViewChange" + isis_group; t.Starta (); } Else {Console.WriteLine ("[GroupConnector] [se förändring] [{0}] Vissa förändringar perspektiv (t.ex. gå). ingen åtgärd krävs" Thread.currentThread.Nom) }} Skyddad RemoteRegisterMySQLServer tomt (daemon kedja. värd sträng. strängen port köpa canada goose jacka i malmö dam . kanalstatus canada goose jacka i malmö dam . kanalroll. last_update) {t = new Thread Diskussion (delegat () {lås (thisLock) {int idx = mysqlServers.FindIndex (delegat (MySQLServer server) {return ((== server.isis_daemon daemon) && (värd == server.host) && (server.port == port));}); if (idx == - 1) {mysqlServers.Add (nytt MySQLServer (demon. värd. port. status. roll. last_update)); Console.WriteLine ("[GroupConnector] [fjärr mysql register] [{0}] Added {1} - {2} - {3} - {4} - {5} - {6} -30 Nytt antal servrar {7} "Thread.CurrentThread.Name. demon. värd. port. status. roll. last_update . mysqlServers.Count);}}}); t.Name = "RemoteRegisterMySQLServer" + isis_group; myGroup.SetReplyThread (t); t.Priority = ThreadPriority.AboveNormal; t.Start (); } Skyddad tomt RemoteUnregisterMySQLServer (daemon kedja. värd sträng. strängen port) {t = new Thread Diskussion (delegat () {lås (thisLock) {int idx = mysqlServers.FindIndex (delegat (MySQLServer server) {return ((server.isis_daemon = = Demon) && (värd == server.host) && (server.port == port));}); Om {server = MySQLServer mysqlServers [IDX] (idx = -1.) Console.WriteLine ("[GroupConnector] [Avsluta prenumeration] [{0}] ta bort server {1} - {2} - {3} - {4} - {5} - {6} - {7}" Thread. CurrentThread.Name. server.isis_daemon, canada goose jacka nypris Sverige . server.host. server.port. server.role. server.status. server.last_update. serveur.TTL) mysqlServers.RemoveAt (idx); }}}); t.Name = "RemoteUnregisterMySQLServer" + isis_group; myGroup.SetReplyThread (t); t.Priority = ThreadPriority.AboveNormal; t.Start (); } Skyddad RemoteHeartbeat tomt (daemon kedja. värd sträng. sträng portkanalstatus. int ttl. last_update sträng) {if (demon IsisSystem.GetMyAddress == (). ToString ()) {Console.WriteLine (" [GroupConnector] [hjärtslag] [{0}] Thread.CurrentThread.Name Heartbeat Omedveten budskap till oss själva för att undvika dödläge. "Thread canada goose jacka i malmö dam 2015 .CurrentThread.Name). gå tillbaka; } Gäng t = new Thread (delegat () {lås (thisLock) {int idx = mysqlServers.FindIndex (delegat (MySQLServer server) {return ((== server.isis_daemon daemon) && (värd == server, canada goose jacka naturkompaniet sweden .host) && ( server.port == port));}); if (idx = -1) {mysqlServers [IDX] .ttl TTL =;. mysqlServers [IDX] canada goose jacket outlet priser .status = état; mysqlServers [IDX] = .last_update last_update; serveur MySQLServer = mysqlServers [IDX]; Console.WriteLine ("[GroupConnector] [battement de coeur] [{0}] serveur de battement de coeur {1} - {2} - {3} - {4} - {5} - {6} - {7} ". Thread.CurrentThread.Name canada goose online shopping Sverige . server.isis_daemon. server.host. server.port. server billiga canada goose aviator hat pbi .role. server.status. server.ttl. server.last_update);}}}); t canada goose real jackets billigt .Name = "RemoteHeartbeat" + isis_group; myGroup.SetReplyThread (t); t.Priority = ThreadPriority.AboveNormal; t.Start (); } Protégée RemoteExpireMySQLServer vide (Chaîne demon. Chaîne hôte. le port de sträng) {diskussions t = new Thread (Délégué () {verrouillage (thisLock) {int idx = mysqlServers.FindIndex (Délégué (serveur MySQLServer) {return ((server. isis_daemon == démon) && (server.host == hôte) && (server.port == le port));}); if (idx = -1) {serveur MySQLServer = mysqlServers [IDX];. Console.WriteLine ( "[GroupConnector] [expirera distans] [{0}] enlever le serveur {1} - {2} - {3} - {4} - {5} - {6} - {7}". Fil CurrentThread.. Namn. server.isis_daemon. server.host. server.port. server.role. server.status. server.last_update. server.ttl); mysqlServers.RemoveAt (idx);}}}); t.Name = "RemoteExpireMySQLServer" + isis_group; myGroup.SetReplyThread (t); t.Priority = ThreadPriority.AboveNormal; t.Starta (); } Void Public RegisterMySQLServer (värd sträng. strängen port. kanalstatus. rollen sträng) {myGroup.SafeSend (UPDATE_MYSQL_REGISTER. IsisSystem.GetMyAddress (). ToString (). värd. port. status. roll . DateTime.Now.ToString ()); } Void Public UnregisterMySQLServer (värd sträng. strängen port) {myGroup.SafeSend (UPDATE_MYSQL_UNREGISTER. IsisSystem.GetMyAddress () toString (). värd. port.) } public String GetMySQLServers () {string serverlist = ""; lås (thisLock) {foreach (MySQLServer server i mysqlServers) {serverlist server.isis_daemon + + = ""; Serverlist + = server.host + ""; Serverlist + = server.port + ""; Serverlist + = server.status + ""; Serverlist + = server.role + ""; Serverlist + = server.ttl + ""; Serverlist + = + server.last_update Environnement.NewLine; }} Återgå serverlist; } Void Public HeartbeatMySQLServer (värd sträng. strängen port. kanalstatus) {lås (thisLock) {int idx = mysqlServers.FindIndex (delegat (MySQLServer server) {return ((server.isis_daemon IsisSystem.GetMyAddress == () . toString ()) && (värd == server.host) && (server.port == port));}); if (IDX canada goose outlet españa 2015 . = -1) {/ * Vi har skapat det här. Därför vet vi hur man tolkar tiden. Dess vår klocka. * / String = last_update DateTime.Now.ToString (); Console.WriteLine ("LastUpdate hjärtslag innan {0}". mysqlServers [IDX] .last_update) myGroup.SafeSend (UPDATE_MYSQL_HEARTBEAT. IsisSystem.GetMyAddress () toString (). värd. port. status. 30 last_update.) mysqlServers [idx] .ttl = 30; mysqlServers [IDX] = .status status; mysqlServers [IDX] = .last_update last_update; Console.WriteLine ("hjärtslag LastUpdate efter {0}". mysqlServers [IDX] .last_update) }}} Void Public ExpireMySQLServer () {/ * OBS. vi andas ut servrarna en efter en. kan ta flera samtal att avsluta alla våra döda servrar * / string remove_host = ""; remove_port string = ""; lås (thisLock) {int idx = mysqlServers.FindIndex (delegat (MySQLServer server) {återvända server.isis_daemon IsisSystem.GetMyAddress == () toString ();.}); if (IDX. = -1) {/ * Detta är en av våra servrar som vi har den last_update tiden. Så vi kan bara * det kommer att upphöra. Den last_update tid bör tolkas i förhållande till bara vår lokala klockan. * Andra servrar kan ha olika lokal tid - klockor kan inte synkroniseras * / Server MySQLServer = mysqlServers [IDX] .; LastUpdate Date = DateTime.Parse (server.last_update) Timespan diff = DateTime.Now - lastUpdate; Timespan maxTTL = ny tidsrymd (0. 0. server.ttl) if (diff> maxTTL) = {remove_host server.host; remove_port = server.port; }}} Om (remove_host. = "") {MyGroup.SafeSend (UPDATE_MYSQL_EXPIRE. IsisSystem.GetMyAddress () toString (). remove_host. remove_port.); }}} {Classe GroupDaemon Chaîne protégée [] = {mysqlstatus "på". "off". "à partir de". "se arrêter". "veille"}; protégée string [] = {mysqlRole "maître". "esclave". "autonome"}; Protege GroupConnector isisConnector; GroupDaemon publique (GroupConnector c) {isisConnector = c; } Public void ReceiveCallback (IAsyncResult asyncCall) {byte [] questionBuffer = new byte [512]; System.Text.ASCIIEncoding kodar = nouvelle System.Text.ASCIIEncoding (); Socket Auditeur = (Socket) AsyncCall.AsyncState; klient Socket = listener canada goose vests men billiga .EndAccept (asyncCall); int byteCount = client.Receive (questionBuffer. SocketFlags.None); if (byteCount> 0) {string fråga = encoding.GetString (questionBuffer); Chaîne Réponse = ParseCommands (fråga); Console.WriteLine ("Q. {0} {1} '". byteCount. fråga); Console.WriteLine ("A. {0} {1} '". answer.Length. réponse); client.Send (encoding.GetBytes (réponse)); Client.Close} (); listener.BeginAccept (nouvelle AsyncCallback (ReceiveCallback). Auditeur); } ParseCommands à Cordes publics (commande de Chaîne) {if (command.IndexOf (Environnement.NewLine)> 0) {commande = command.Substring (0. command.IndexOf (Environment.NewLine) - 1); } string [] = pièces command.Split (ny char [] {''}. StringSplitOptions.RemoveEmptyEntries); om (delar.Längd <1) {return "une commande non Valide"; } För (int i = 0; i discount canada goose jacka unisex . IsListed (parter [4]. mysqlRole))}. om {return '+ pièces [4] + 4 "Inconnu mysqlRole" "'. la syntaxe discount canada goose yorkville bomber ." syntaxe +; } IsisConnector.RegisterMySQLServer (pièces [1]. pièces [2]. pièces [3]. pièces [4]); retourner "0 OK"; } Else if (partier [0] == "quitter") {string syntaxe = "laisser "; Om {return "2 Le Nombre de parametrar. de la syntaxe." (parts.Length = 3.) + syntaxe; } IsisConnector canada goose jacka i malmö dam .UnregisterMySQLServer (partier [1]. les parter [2]); retourner "0 OK"; } Else