记录
简介: 专有云已从概念走向落地实践。由云计算标准和开源推进委员会举办的“专有云技术主题沙龙”,除对专有云标准体系等进行解读外,还邀请了业内大咖倾情分享,共同探索专有云未来发展趋势。
banner.jpg
随着十四五规划强调打造数字经济新优势,将云计算列为数字经济重点产业,明确了以混合云为重点的云服务产业发展路线:“以混合云为重点培育行业解决方案、系统集成、运维管理等云服务行业”,混合云成为产业内众多服务商和政企客户关注的焦点。
2022年6月8日,由中国信息通信研究院、中国通信标准化协会主办,云计算标准和开源推进委员会承办的“专有云技术沙龙”线上直播圆满结束。本次沙龙除对专有云标准体系等进行解读外,还邀请了业内大咖倾情分享,共同探索专有云未来发展趋势。
阿里云混合云产品解决方案总经理李亮,与会并分享了「混合云建管用一体化探索实践」。阐述了阿里云混合云如何通过提供全栈建云、智能管云、极致用云一体化解决方案、完善的混合云服务和开放的混合云生态,助力政企应对数字化转型难题。
image.png
如今,越来越多的企业认同,混合云是实现数字化变革的必由之路。但由于每个企业所处的数字化阶段不同、需求各异,所以混合云建设的路径、方法和过程也不尽相同。在实现应用现代化的过程中,企业的IT管理者该如何选择一条最适合自己的技术转型道路呢?
毫无疑问,只有打好数字基础设施的根基,才能进一步增强业务的韧性,有效应对日益复杂的应用需求,实现业务的创新与可持续增长。
李亮指出:作为推进政企数字化转型的核心基础设施,阿里云混合云(Apsara Stack)是业界最早践行公共云和专有云“同一架构”理念的云厂商,采用历经13年打磨的飞天云计算操作系统,与公共云同根同源,是国内首个全自研大规模成熟商用的原生混合云,且历经多年“双11”检验,集全栈建云、智能管云、极致用云于一体的全栈云平台。
image.png
全栈建云
以飞天3.0为核心的阿里云混合云,具备“一云多芯”的能力,全面兼容X86、ARM等多种芯片全场景混部(Region内混部、同城容灾混部、跨Region混部)和统一调度。同时,阿里云混合云可以为政企客户构建大规模的跨地域多数据中心的“一朵云”, 打破地域限制,按照客户需求进行分层部署,分层为多个Region,各个Region之间相互关联、统一管理。 具备全场景容灾能力,支持传统的两地三中心架构&创新的同城三机房架构,实现核心业务RPO=0。
历经8年行业深耕,阿里云混合云通过公安部等保三级、可信云认证、ISO27001、CSA等众多权威机构认证,是国内首家通过商用密码应用安全性评估的云厂商,为客户构建了全方位安全防护体系。
智能管云
此外,阿里云混合云提供统一的混合云管理平台,支持云资源智能管理和云平台自动化运维。开放的OpenAPI平台提供丰富的SDK包和RESTful API接口。对于运维管理,通过OpenAPI获取云平台的基础管控信息,可以实现自定义管控系统的研发。
安装
```bash
yum install -y nodejs npm GraphicsMagick gcc gcc-c++
tar zxvf rocket.chat-3.9.0.tgz -C /tmp
npm install n -g #安装版本切换工具,需要注意n切换的node命令在/usr/local/bin下,而root用户优先读取/usr/bin下的
n 12.18.4 切换版本
ln -s /usr/local/bin/node /usr/bin/node
ln -s /usr/local/bin/node /usr/bin/nodejs
#安装依赖
chown -R 1001:116 /root
cd /tmp/bundle/programs/server && NODE_ENV=production npm install
sudo mv /tmp/bundle /opt/Rocket.Chath
```
# 搭建mongo主从
```bash
每个节点
vim /etc/mongod.conf
bindIp: 0.0.0.0
replication:
replSetName: rs01 #副本集名称
systemctl start mongod
mongo
rs.initiate() #初始化
rs.conf()
rs.add("$host",flase|true) 后面的布尔值代表是否是仲裁节点
rs.status()
```
# 启动
```bash
MONGO_URL=mongodb://172.16.1.28:27017/rocketchat MONGO_OPLOG_URL=mongodb://172.16.1.28:27017/local?replicaSet=rs01 ROOT_URL=http://localhost:3000/ PORT=3000 node main.js
```
# nginx
```bash
upstream myserver{
server 127.0.0.1:8081;
server 127.0.0.1:8082;
ip_hash, #ip
hash $request_uri # 基于url
least_conn; #连接数
}
```
# mysql 双主
```bash
auto_increment_increment:表示自增长字段每次递增的量,其默认值是1。
它的值应设为整个结构中服务器的总数,本例用到两台服务器,所以值设为2。
auto_increment_offset:设定数据库中自动增长的起点(即初始值)。
因为两台服务器都设定了一次自动增长值2,所以它们的起点必须不同,才能避免两台服务器的数据在同步时出现主键冲突。
server-id
logbin=mysql-bin
# 两台都给对方添加master to 配置
```
# Namespace管理
```yaml
# 注意 标签project=test
apiVersion: v1
kind: Namespace
metadata:
creationTimestamp: null
name: test
lables:
project: test
spec: {}
status: {}
```
# Secrets管理--Opaque
```yaml
apiVersion: v1
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
kind: Secret
metadata:
name: mysecret
namespace: default
type: Opaque
```
# 创建http存活探针
```yaml
apiVersion: v1
kind: Pod
metadata:
labels:
run: liveness-http
name: liveness-http
spec:
containers:
- image: nginx
name: liveness-http
livenessProbe:
initialDelaySeconds: 15
failureThreshold: 1
httpGet:
port: 80
host: 127.0.0.1
```
# wordpress应用部署
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: wordpress
name: wordpress
spec:
replicas: 1
selector:
matchLabels:
app: wordpress
template:
metadata:
labels:
app: wordpress
spec:
containers:
- image: wordpress:latest
name: wordpress
imagePullPolicy: IfNotPresent
volumeMounts:
- name: data
mountPath: /var/www/html
env:
- name: WORDPRESS_DB_DATABASE
value: wordpress
- name: WORDPRESS_DB_USER
value: wordpress
- name: WORDPRESS_DB_PASSWORD
value: wordpress
- name: WORDPRESS_DB_HOST
value: 172.18.10.100:11213
volumes:
- name: data
persistentVolumeClaim:
claimName: wp-pv-claim
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: wordpress
name: wordpress
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
nodePort: 31000
selector:
app: wordpress
type: NodePort
status:
loadBalancer: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: mysql
name: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: mysql
spec:
containers:
- image: mysql:latest
imagePullPolicy: IfNotPresent
name: mysql
volumeMounts:
- name: data
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: wordpress
- name: MYSQL_DATABASE
value: wordpress
- name: MYSQL_USER
value: wordpress
- name: MYSQL_PASSWORD
value: wordpress
volumes:
- name: data
persistentVolumeClaim:
claimName: mysql-pv-claim
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: mysql
name: mysql
spec:
ports:
- port: 3306
protocol: TCP
targetPort: 3306
nodePort: 11213
type: NodePort
selector:
app: mysql
status:
loadBalancer: {}
```
# pv
```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-persisten-storage
spec:
nfs:
server: 172.18.10.100
path: /data/servers/mysql
accessModes: ["ReadWriteOnce"]
capacity:
storage: 20Gi
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: wordpress-persisten-storage
spec:
nfs:
server: 172.18.10.100
path: /data/servers/wordpress
accessModes: ["ReadWriteOnce"]
capacity:
storage: 20Gi
persistentVolumeReclaimPolicy: Recycle
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
accessModes: ["ReadWriteOnce"]
volumeName: mysql-persisten-storage
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wp-pv-claim
spec:
accessModes: ["ReadWriteOnce"]
volumeName: wordpress-persisten-storage
resources:
requests:
storage: 20Gi
```
# chartmuseum仓库部器
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: chartmuseum
name: chartmuseum
spec:
replicas: 1
selector:
matchLabels:
app: chartmuseum
template:
metadata:
labels:
app: chartmuseum
spec:
containers:
- image: bitnami/chartmuseum:latest
imagePullPolicy: IfNotPresent
name: chartmuseum
ports:
- containerPort: 8080
protocol: TCP
env:
- name: DEBUG
value: "1"
- name: STORAGE
value: local
- name: STORAGE_LOCAL_ROOTDIR
value: /charts
# volumeMounts:
# - mountPath: /charts
# name: charts-volume
# volumes:
# - name: charts-volume
# nfs:
# path: /data/upload/charts
# server:
```
# 开发
# cce
yaml转json
json转yaml
dstr=json.dumps(d) *#dict转成字符* dyaml=yaml.load(dstr) *#将字符转仓yaml*
```python
import yaml
import json
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcce.v3.region.cce_region import CceRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcce.v3 import *
if __name__ == "__main__":
ak = "LZFXYQZTP2WFS0LKJSLQ"
sk = "1iE4AnxT5F6xxFkxmDKSEqDNqgtuLWa1yfrCiTDQ"
credentials = BasicCredentials(ak, sk) \
client = CceClient.new_builder() \
.with_credentials(credentials) \
.with_region(CceRegion.value_of("cn-east-3")) \
.build()
file=open("cluster.yaml",'r')
try:
request = CreateClusterRequest()
with open("cluster.yaml","r") as file:
s=yaml.safe_load(file)
request.body = Cluster(spec=s["spec"],kind=s["kind"],metadata=s["metadata"],api_version=s["apiVersion"])
# print(request.body["kind"])
response = client.create_cluster(request)
request=ListClustersRequest()
res=client.list_clusters(request).to_dict()
for item in res["items"]:
if item["metadata"]["name"]=="kcloud":
clusteruid=item["metadata"]["uid"]
request=ShowClusterRequest(cluster_id=clusteruid)
print(json.dumps(client.show_cluster(request).to_dict()))
print(client.show_cluster(request).to_dict())
except exceptions.ClientRequestException:
print("集群存在同名")
print(json.dumps(client.show_cluster(request).to_dict()))
print(client.show_cluster(request).to_dict())
try:
request = CreateNodeRequest()
request.cluster_id = clusteruid
extendParamSpec = NodeExtendParam(
max_pods=110
)
runtimeSpec = Runtime(
name="docker"
)
primaryNicNodeNicSpec = NicSpec(
subnet_id="351f6e32-4b49-4f09-a374-fb242d2dbb3d"
)
nodeNicSpecSpec = NodeNicSpec(
primary_nic=primaryNicNodeNicSpec
)
listVirtualSpacesStorageGroups = [
VirtualSpace(
name="runtime",
size="90%"
),
VirtualSpace(
name="kubernetes",
size="10%"
)
]
listSelectorNamesStorageGroups = [
"cceUse"
]
listStorageGroupsStorage = [
StorageGroups(
name="vgpaas",
cce_managed=True,
selector_names=listSelectorNamesStorageGroups,
virtual_spaces=listVirtualSpacesStorageGroups
)
]
matchLabelsStorageSelectors = StorageSelectorsMatchLabels(
size="100",
volume_type="SAS",
count="1"
)
listStorageSelectorsStorage = [
StorageSelectors(
name="cceUse",
storage_type="evs",
match_labels=matchLabelsStorageSelectors
)
]
storageSpec = Storage(
storage_selectors=listStorageSelectorsStorage,
storage_groups=listStorageGroupsStorage
)
listDataVolumesSpec = [
Volume(
size=100,
volumetype="SAS"
)
]
rootVolumeSpec = Volume(
size=50,
volumetype="SAS"
)
loginSpec = Login(
ssh_key="KeyPair-4c00"
)
specbody = NodeSpec(
flavor="c6s.xlarge.2",
az="cn-east-3b",
os="EulerOS 2.9",
login=loginSpec,
root_volume=rootVolumeSpec,
data_volumes=listDataVolumesSpec,
storage=storageSpec,
node_nic_spec=nodeNicSpecSpec,
count=1,
billing_mode=0,
runtime=runtimeSpec,
extend_param=extendParamSpec
)
metadatabody = NodeMetadata(
name="kcloud-server"
)
request.body = NodeCreateRequest(
spec=specbody,
metadata=metadatabody,
api_version="v3",
kind="Node"
)
response = client.create_node(request)
print(response)
except exceptions.ClientRequestException as e:
print(e.status_code)
print(e.request_id)
print(e.error_code)
print(e.error_msg)
```
# server
```python
import json
import huaweicloudapi
conn=huaweicloudapi.get_conn_aksk()
imageid=conn.image.find_image(name_or_id="CentOS 7.5 64bit").id
sec_id=conn.vpcv1.find_security_group(name_or_id="chinaskills_security_group")
data={
"dry_run": False,
"server": {
"imageRef": imageid,
"flavorRef": "c6.large.2",
"name": "chinaskills_server",
"vpcid": "f3f84ee9-6ff5-4454-9516-312a93c3815d",
"nics": [
{
"subnet_id": "351f6e32-4b49-4f09-a374-fb242d2dbb3d"
}
],
"publicip": {
"eip": {
"iptype": "5_bgp",
"bandwidth": {
"size": 5,
"sharetype": "PER"
},
"extendparam": {
"chargingMode": "postPaid"
}
}
},
"root_volume": {
"volumetype": "SSD",
"size": 100
},
"data_volumes": [
{
"volumetype": "SSD",
"size": 50
}
],
"security_groups": [
{
"id": sec_id
}
],
"server_tags": [
{
"key": "chinaskills",
"value": "true"
}
]
}
}
i=conn.ecs.find_server(name_or_id="chinaskills_server")
if not i:
conn.ecs.create_server(**data)
else:
conn.ecs.delete_server(server=i.id)
conn.ecs.create_server(**data)
print(conn.ecs.get_server(id=i.id))
json.dumps()
```
- 点赞
- 收藏
- 关注作者
评论(0)