Disaster recovery and Clustering (1)
in the previous article: Microsoft Distributed Cloud Computing Framework Orleans (1): Hello World , we probably know how to use Orleans, of course, the previous example can be said to be simple and invalid, because with Orleans can not write only a Hello World, Orleans is for the distributed and cloud computing framework, then today we will briefly say that disaster, The application of cluster, disaster tolerance and cluster in Orleans.
What is a cluster?
The following excerpt from the Baidu Encyclopedia:
Cluster (cluster) technology is a relatively new technology, through clustering technology, can be paid at a lower cost in the performance, reliability, flexibility of relatively high returns, and its task scheduling is the core technology in the cluster system.
A cluster is a set of independent computers interconnected by high-speed networks, which form a group and are managed in a single system mode. When a customer interacts with a cluster, the cluster is like a separate server. Cluster configuration is used to improve availability and scalability.
A simple overview is: By technical means to combine multiple computers (servers) into a "one calculator" to provide computing services.
What is disaster tolerance?
The following excerpt from the Baidu Encyclopedia:
Disaster tolerant system refers to the distance between the remote, the establishment of two sets or more sets of functions of the same IT system, between each other can be health monitoring and functional switching, when a system due to accidents (such as fire, earthquake, etc.) stop working, the entire application system can be switched to another place, so that the system function can continue to work normally. Disaster-tolerant technology is an integral part of the high-availability technology of the system, and the disaster-tolerant system emphasizes the influence of the external environment on the system, especially the impact of catastrophic events on the whole it node, and provides the system recovery function at the node level.
A simple overview is that when some servers are unavailable, you can switch to an available standby server to improve service availability.
the relationship between disaster tolerance and cluster?
Individual think disaster tolerance is a kind of demand, purpose, goal, and cluster is a technical means, use the cluster can provide availability and scalability, then also solve the problem of disaster tolerance, of course, not limited to the cluster mirror site can also solve the disaster tolerance problem. Just like the relationship between the IOC and DI.
Build Orleans Clustera simple cluster
For the previous experience, this time some changes were made to the grain of the "sample.interfaces" and "sample.implements" layers, with the following code:
The code logic is not changed, but closer to the intent of grain, let's look at the client's call.
You can see this time the phone number as key to the grain, so more in line with the actor thought, feel a bit like restful.
Here's a look at the server that needs the cluster:
In fact, in the last demo on the basis of no need to change any code to implement the cluster, but in order not to copy multiple programs, I have server-side load configuration files and set the node name to do a dynamic input, the code is as follows:
There is not much change, just to specify which profile to load and which node to start, let's focus on the Orleans configuration file.
The final profile effect is as follows, let's run a look at the effect and then look back at the configuration file.
Start Server.exe First, enter "Orleansconfiguration"
In the input node name: "node1", wait for the start to complete.
Then we run a client program.
To test.
Server.exe will appear. I processed a request that represented logic as normal. Then we are running a Server.exe.
The configuration file name is called "orleansconfiguration" and the node name is: "node2".
Wait for the start to complete.
To continue switching to the client for testing, the following results will appear:
On behalf of the request is distributed, the rules for distribution are controlled by Orleans, and if you wish you can restart multiple Server.exe for clustering. It can be node3, Node4, Noden.
We then close the Node2 ( press ENTER to close, do not close the window directly) and continue to switch to the client for testing.
The discovery can still be requested normally.
Such a simple cluster is done.
This cluster is taking advantage of the "membershiptable" approach provided by Orleans, which is deprecated in formal environments and is recommended for use only at development time, for simple demonstration purposes this will be a simple explanation for this approach.
Demo Source: https://github.com/majian159/Samples/tree/master/OrleansSamples/Clusters
configuration file
Let's look back at the configuration file.
Focus on the 3 lines of code I circled.
Seednode
Silo (Silo) address this address is configured I belong to a certain silo, some silo can use me.
The cluster needs to connect to a specified silo identified as I can provide a compute request for this silo.
Networking
Silo endpoint for each host (Server) to connect to, one cluster with only one.
That is, the cluster needs to connect to the address of a place.
Proxyinggateway
Proxy Gateway, the channel that the client invokes.
The client sends the requested receive channel.
Override
Overrides, can be configured according to the node name, for example, our node1 will be effective for networking and Proxyinggateway configuration, node2,node3 Other nodes will not be.
Relationship
It can be seen that our first running Node1 node assumed part of the calculation request, silo management role, Node2 took part in the calculation request. There are 3 actual roles.
1. Calculated by 1
2. Calculated by 2
3.silo Manager
and Node1 carrying 1, 3 of these two roles, this time will certainly be questioned: "This pressure is not yet shared?" If my node1 hangs, it's all over? ”
The answer is yes, which is why Orleans does not recommend using this cluster approach in a formal environment, and in subsequent chapters we will describe other cluster scenarios that allow the roles of silo managers to be assigned to those responsible.
Request Structure
Next
The next article will say how to share the role of Soli manager, sharing the way Orleans provided: Mysql,sql Server, Zookeeper, Azure Table.
Of course not one by one instructions, should be similar, may choose MySQL or SQL Server.
Mode of communication
QQ Group: 384413261 (Rabbithub)
Email: [email protected]
Disaster recovery and Clustering (1)