In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Jingdong Cloud File Service (Cloud File Service, hereinafter referred to as: CFS) is a highly reliable, scalable, shared and fully managed distributed file system. Without interrupting the application service, it can be expanded or reduced on demand according to your use of the file system, and charged according to the actual usage. It adopts NFS protocol and supports POSIX file interface, which can provide shared access service for CVMs under Linux system.
Demo diagram:
First, create a CVM
Open JD.com Cloud console, click on the left navigation elastic computing-CVM, and create two CVMs in North China-Beijing in the same region as the cloud file service. The configuration is as follows:
Type of payment: by configuration
Region and availability Zone: North China-Beijing / availability Zone C
Image: official image-CentOS 7.664-bit
Specification: 1 core 4G (for testing only)
Storage: default
Network: select a created VPC and subnet, and if not, create a new one
Bandwidth: 1Mbps
Name:
1BASh2yum install nginx-y & & rm-rf / usr/share/nginx/html/index.html & & wget-P / usr/share/nginx/html/ https://pocenv-hcc.s3.cn-north-1.jdcloud-oss.com/cfs/index.html & & cd / etc/nginx/ & & mv nginx.conf nginx.conf.bak & & wget https://pocenv-hcc.s3.cn-north-1.jdcloud-oss.com/cfs/nginx.conf & & systemctl enable nginx & systemctl start nginx & & systemctl stop firewalld & & systemctl disable firewalld
Purchase quantity: 2
Custom data description: 1 fixed content on the first line of the Linux script
2yum install nginx-y # yum install the ningx service
3rm-rf / usr/share/nginx/html/index.html # remove the default home page of nginx
4wget-P / usr/share/nginx/html/ https://pocenv-hcc.s3.cn-north-1.jdcloud-oss.com/cfs/index.html # download Custom Home Page
5cd / etc/nginx/ # go to the directory where the nginx configuration file is located
6mv nginx.conf nginx.conf.bak # back up the original nginx configuration file
7wget https://pocenv-hcc.s3.cn-north-1.jdcloud-oss.com/cfs/nginx.conf # download custom configuration file
8systemctl enable nginx # set nginx to boot automatically
9systemctl start nginx # launch nginx
10systemctl stop firewalld # turn off the firewall
11systemctl disable firewalld # permanently turn off the firewall
The symbol "12" & # indicates that the following operation will not be performed until the previous command is executed successfully.
The contents of the index.html file in the custom data are as follows: 12 3 4 this is a display page of Nginx calling cfs file 5 6.ss {7width: 800px; 8height: 280px; 9display: flex;10align-items: center;11justify-content: center;12} 13.ssimg {14width: 100% center;12 15height: 100% acid 16} 17h3 {18color: red;19} 20212223 below the file [1.png] 24 picture path is / data/img/1.png2526272829
The result of the new CVM is as follows:
Now let's copy the public network IP of the CVM to the browser to view the results as follows:
Second, create application-based load balancer (ALB) 1. Create a load balancer
Open the JD.com Cloud console, click the left navigation network-load balancer, and then select North China-Beijing in the application type and click the create button.
Select the application load balancer and click OK
The configuration is as follows:
Region and availability Zone: North China-Beijing-availability Zone Select availability Zone A, availability Zone B, availability Zone C
Network: select the same VPC as the CVM (the subnet is arbitrary, you can choose the same subnet as the CVM, or you can create a new subnet, because the subnets under the same VPC are interconnected by default), and the security group chooses the default security group to open all ports.
Bandwidth: 1Mbps
Name: cfs_alb
After the creation is completed, it is shown below:
two。 Configure load balancer 2.1 create a new virtual server group
Click the name of the created load balancer instance, as shown in the following figure. Find the virtual server group, and click New Virtual Server Group.
Enter the group name as tg, add the two CVMs we created to the server group, and click OK.
2.2 create a new backend service
As shown in the figure, click New backend Service after finding the backend service.
The configuration is as follows:
Basic information:
Name: backend
Back-end protocol: default Http
Port: 80
Scheduling algorithm: default weighted polling
Others remain by default
Health check:
Health check method: HTTP
Check port: 80
Others remain by default
Add a server group:
Select server group: select the virtual server group `tg` created above
2.3 create a new listener
As shown in the figure, click New listener after finding the listener
The configuration is as follows:
Front-end monitoring configuration:
Snooping protocol [port]: Http 80
Others remain by default
Backend forwarding configuration:
Default backend service: select backend service
Backend service name: select the previously created backend service `backend`
Others remain by default
Health check:
Keep the default
Add a server group:
Keep the default
2.4 View the effect
Copy the public network IP of the load balancer to the browser to view the effect
3. Create cloud file service
First of all, we need to open the JD.com cloud official website: http://www.jdcloud.com, click the upper right console to log in, click on the left navigation storage-Cloud File Service, and click create File Storage in North China-Beijing. The configuration is as follows:
Region: North China-Beijing
Name: cfs_test
Virtual private cloud: select the same VPC as the CVM
Create mount target: select the same subnet as the CVM
The creation result is as follows:
4. To mount the file storage, you need to log in to two CVMs to perform the following operations.
3.1Log in to the CVM we have created and install nfs
1yum install-y nfs-utils-y
Under the terminal of the Ubuntu system, run the following command: sudo apt-get install nfs-common
3.2 create a data directory for mounting file storage
1mkdir-p / data/img
3.3.Mount the file storage by the IP address of the mount target. The IP address of the mount target can be found on the "console-Storage-Cloud File Service-File Storage" page. Click the ID of the file storage to view it.
For example, the directory of the mount target is 10.0.0.19:/cfs, and mount it to the nfs directory created in the previous step.
Note that because the default NFS protocol of the mount tool is version 4.0, the mount commands for CentOS 7.2 and below are slightly different:
CentOS versions 6.9 through CentOS 7.2 run the following command:
Mount-t nfs,nfsvers=4.0,-o lookupcache=none 10.0.0.19:/cfs / data
CentOS 7.3and later runs the following command:
Mount-t nfs-o lookupcache=none 10.0.0.19:/cfs / data
Under the terminal of the Ubuntu system, run the following command:
Mount-t nfs 10.0.0.19:/cfs / data
5. Verify that the mount is successful by running the following command:
1df-h
After the mount is successful, "Filesystem" is the mount target IP, and "Mounted on" is the record of the directory specified in the previous step.
5. Upload test files
First prepare a picture in png format, rename it to 1.png, and save it to the desktop.
Use tools such as WinSCP or FTP to upload the prepared test images to the / data/img directory of the CVM web01
After the upload is completed, copy the public network IP of the load balancer to the browser to view the results as follows:
Now we stop and delete the CVM web1 in the console, and then refresh the browser, and find that the test image can still be displayed normally. The reason is that the test image is directly uploaded to JD.com 's cloud file service CFS, and the CVM web1 and web2 share the data in the CFS, so deleting the CVM will not affect the uploaded image.
Click "Jingdongyun" to learn about JD.com Yunyun document service products
Welcome to click "Jingdong Yun" to learn more wonderful content.
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.