In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Customer demand
Shanghai District Yun, Beijing District Yun, IDC interconnection.
Shanghai District is the production environment, Beijing District is disaster preparedness, and IDC is the office computer room.
Specific requirements:
1 and 2 direct connect lines from IDC- Shanghai and IDC- Beijing respectively, which can switch between active users and active users.
2. Shanghai and Beijing are interconnected, and the data of disaster preparedness in Beijing are consistent with those in Shanghai. Implementation of difficult network segment overlap: customer's Shanghai, Beijing and IDC are all 172.18.0. IDC 16 network segment Direct Connect switching: IDC- Shanghai, IDC- Beijing, any Direct Connect interruption can be automatically switched to another. Demand analysis
1. Due to the overlap of network segments, peering connection cannot be used. Cloud networking can only be used to solve the problem of network segment overlap.
2. The customer IDC is also 172.18.0.0 IDC 16, which leads to routing conflicts between Shanghai and Beijing, which cannot exist at the same time. Therefore, you can only switch to Beijing-IDC after the interruption of the Shanghai-IDC direct connection. Use python to call the cloud networking SDK operation to turn routing on / off.
3. In terms of disaster recovery in Beijing, the cloud database uses DTS to synchronize data in real time, and website files use COS migration tool to migrate Shanghai CVM data to Beijing COS, and then the Beijing server gets the data from COS. Or use rsync to synchronize data directly. The Beijing server can be mirrored by the server in the configured environment in Shanghai, copied to Beijing, and then used to open the server.
Operation configuration 1. Cloud networking configuration: create a new cloud networking (currently, you need to apply for this product in the public trial phase), and associate the corresponding instance
After the instance is associated, the routes owned by the instance are automatically added to the cloud network routing table.
2. Direct Connect configuration (cloud platform)
Direct Connect gateway creation configuration (Cloud products-> Virtual Private Cloud-> Direct Connect gateway)
When you create a new Direct Connect gateway, the associated network type should be cloud networking. Cloud networking instances can be associated now or later. Private tunnel creation configuration (Cloud products-> Direct Connect access-> dedicated tunnel)
Select the Direct Connect type when creating a private tunnel. In this example, a shared Direct Connect is used. You need to enter the account ID of the Direct Connect provider and the shared Direct Connect ID, and select cloud networking when connecting to the network. A Direct Connect (dedicated tunnel) corresponds to a Direct Connect gateway.
The VLAN ID and the BGP AS number on the IDC side need to be requested from the direct connect provider, and the border IP and the direct connect provider negotiate the plan. After these configurations, wait for the Direct Connect provider to accept the submitted application, and then configure BGP on the IDC settings to declare the IDC private network segment. If the route is a static route, write the route to the cloud on the device.
3. Add routes to the Direct Connect gateway
Click the Direct Connect gateway that needs to be routed, and enter the IDC network segment to add the IDC network segment you need.
If this Direct Connect gateway does not join the cloud networking, please associate the direct connect gateway under the cloud networking, and the routes added on the direct connect gateway will be automatically added to the cloud networking routing table.
In the cloud network routing table, you can see the details of the route, the next hop, whether to start the route, and so on. If there is route overlap, priority is given to matching long masks (for example, routes with 24 and 25 masks on the same network segment, and routes with 25 masks first). If the route segment is the same, the route is automatically disabled.
Automatically switch routes using cloud-connected SDK
1. Write relevant code
If the code is placed on the relevant server, the trigger script condition can be set to ping tunnel boundary ip and IDC private network ip. If it is not available at the same time, the script will be triggered to switch the Direct Connect.
#! / usr/bin/env python#-*-coding:utf-8-*-# Auther: liyk time:2019/1/3# File: CCN.pyfrom tencentcloud.common import credentialfrom tencentcloud.vpc.v20170312 import vpc_client,modelsimport json#def Auth_vpc (id,key): # Authentication akcred = credential.Credential (id,key) Vpc_client = vpc_client.VpcClient (cred "ap-shanghai") return Vpc_client#def SH_DescribeCcnRoutesRequest (Vpc_client): # get Shanghai Direct Connect gateway route IDreq = models.DescribeCcnRoutesRequest () req.CcnId = 'ccn-a187ua1z'resp = Vpc_client.DescribeCcnRoutes (req) result = json.loads (resp.to_json_string ()) RouteSet = result [' RouteSet'] SH_RouteIds = [] for i in RouteSet: if I ['InstanceName'] = "shanghai-IDC": SH_RouteId = I [ 'RouteId'] SH_RouteIds.append (SH_RouteId) return SH_RouteIds#def BJ_DescribeCcnRoutesRequest (Vpc_client): # get Beijing Direct Connect gateway route IDreq = models.DescribeCcnRoutesRequest () req.CcnId =' ccn-a187ua1z'resp = Vpc_client.DescribeCcnRoutes (req) result = json.loads (resp.to_json_string ()) RouteSet = result ['RouteSet'] BJ_RouteIds = [] for i in RouteSet: if I [' InstanceName'] = "beijing-IDC ": BJ_RouteId = I ['RouteId'] BJ_RouteIds.append (BJ_RouteId) return BJ_RouteIds#def SH_EnableCcnRoutes (Vpc_client SH_id): # Open Shanghai routing req = models.EnableCcnRoutesRequest () req.CcnId = 'ccn-a187ua1z'req.RouteIds = ['% s'% SH_id] print ('Open Shanghai routing% s'% SH_id) resp = Vpc_client.EnableCcnRoutes (req) # print (resp.to_json_string ()) # def BJ_EnableCcnRoutes (Vpc_client) BJ_id): # Open Beijing routing req = models.EnableCcnRoutesRequest () req.CcnId = 'ccn-a187ua1z'req.RouteIds = ['% s'% BJ_id] print ('Open Beijing routing% s'% BJ_id) resp = Vpc_client.EnableCcnRoutes (req) # def SH_DisableCcnRoutes (Vpc_client) SH_id): req = models.DisableCcnRoutesRequest () req.CcnId = 'ccn-a187ua1z'req.RouteIds = ['% s'% SH_id] print ('close Shanghai route% s'% SH_id) resp = Vpc_client.DisableCcnRoutes (req) # def BJ_DisableCcnRoutes (Vpc_client) BJ_id): req = models.DisableCcnRoutesRequest () req.CcnId = 'ccn-a187ua1z'req.RouteIds = ["% s"% BJ_id] print (' close Beijing route% s'% BJ_id) resp = Vpc_client.DisableCcnRoutes (req) # if _ _ name__ = = "_ main__": id = 'AKID*sTzK'key =' KUWT*M'Vpc_client = Auth_vpc (id Key) SH_RouteIds = SH_DescribeCcnRoutesRequest (Vpc_client) BJ_RouteIds = BJ_DescribeCcnRoutesRequest (Vpc_client) # here you can use ping to return the result oper = "normal" if oper = = "normal": for BJ_id in BJ_RouteIds: BJ_DisableCcnRoutes (Vpc_client, BJ_id) for SH_id in SH_RouteIds: SH_EnableCcnRoutes (Vpc_client, SH_id) # SH_DisableCcnRoutes (Vpc_client SH_id) else: for SH_id in SH_RouteIds: SH_DisableCcnRoutes (Vpc_client, SH_id) for BJ_id in BJ_RouteIds: BJ_EnableCcnRoutes (Vpc_client, BJ_id) 2, test effect
Switch when simulating an exception:
At the end of the switch, the interruption is about 30 seconds. The best scheme
If the networks do not overlap, use peering connection between the two VPC, use two cloud networking, and then join the corresponding VPC and IDC Direct Connect respectively, so that double active users can be achieved from the IDC to the cloud. For example, if IDC- is interrupted in Shanghai, you can connect to Shanghai via IDC- Beijing and then via peering connection.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.