In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
In the previous blog post, we demonstrated how to achieve persistent storage of kubernetes through ceph so that stateful services like mysql can run and save data in kubernetes. This looks wonderful, but in the actual production environment, the performance problems of disks implemented through distributed storage will be very prominent in IO-intensive applications such as mysql. Therefore, in practical applications, applications such as mysql will not be managed directly in kubernetes, but will be deployed independently with dedicated servers. Stateless applications like web will still run in kubernetes. At this time, there are two ways for web servers to connect to databases other than kubernetes management: one is to directly connect to the physical server IP where the database is located, and the other is to directly map the external server to a service within kubernetes with the help of kubernetes's Endpoints.
Let's look at a simple example:
ApiVersion: v1kind: Servicemetadata: name: plat-devspec: ports:-port: 3306 protocol: TCP targetPort: 3306---apiVersion: v1kind: Endpointsmetadata: name: plat-devsubsets:-addresses:-ip: "10.5.10.109" ports:-port: 3306
This example defines two kinds of resource objects, Service and Endpoints. The definition of Service does not use a tag selector, but an Endpoints with the same name as Service is defined later, so that they can be associated automatically. The subsets of Endpoints specifies the IP and port of the external server to which you need to connect.
We can look at it through kubectl get svc:
[root@server--IP EXTERNAL--dev. /
We can start another sample container and do the following in the container to try to connect to the external service:
[root@server-116 test] # kubectl exec-it nginx / bin/bash [root@nginx nginx] # nslookup plat-devServer: 10.254.0.100Address: 10.254.0.100#53Name: plat-dev.default.svc.cluster.localAddress: 10.254.4.76 [root@nginx nginx] # mysql-uxxx-pxxx-hplat-devWelcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 349446Server version: 5.6.14 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > show databases
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.