Docker 1.12 集群

时间:2021-12-28 20:45:10

 
 

环境介绍

虚拟机两台,vmware ,网络为NAT

node139:192.168.190.139

Node140: 192.168.190.140

 
 

设置hostname

以139为例

[demo@localhost ~]$ hostname

localhost.localdomain

[demo@localhost ~]$ sudo hostnamectl set-hostname node139

[sudo] password for demo:

[demo@localhost ~]$ hostname

node139

 
 

修改/etc/hosts文件内容如下

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

 
 

127.0.0.1 node139

 
 

140机做同样的设置

 
 

安装dokcer 1.12,使用yum

1.登录到你的机器用户sudo或root权限。

2.确保您现有的包是最新的更新

$ sudo yum update

3.添加yum

$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'

[dockerrepo]

name=Docker Repository

baseurl=https://yum.dockerproject.org/repo/main/centos/7/

enabled=1

gpgcheck=1

gpgkey=https://yum.dockerproject.org/gpg

EOF

 
 

4.安装

$ sudo yum install docker-engine

5 启用该服务。

$ sudo systemctl enable docker.service

6.启动守护进程

$ sudo systemctl start docker

 
 

为了避免使用sudo,您使用docker的命令,创建一个名为UNIX组docker和用户添加到它

创建docker 组

$ sudo groupadd docker

你的用户添加到docker组。

$ sudo usermod -aG docker your_username

注销并重新登录

 
 

Docker监听远程端口实现远程调用API

[demo@node139 ~]$ sudo vim /lib/systemd/system/docker.service

添加以下加粗内容

ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock

重启Docker程序

 
 

[demo@node139 ~]$ sudo systemctl daemon-reload

[demo@node139 ~]$ sudo systemctl restart docker.service

 
 

140机器做同样处理

 
 

解决docker info报错docker bridge-nf-call-iptables is disabled办法

[demo@node139 ~]$ sudo vim /etc/sysctl.conf

添加如下内容

net.bridge.bridge-nf-call-ip6tables = 1

net.bridge.bridge-nf-call-iptables = 1

net.bridge.bridge-nf-call-arptables = 1

 
 

140机器做同样处理

 
 

swarm集群

1防火墙开启

 
 

Open ports between the hosts

The following ports must be available. On some systems, these ports are open by default.

  • TCP port 2377 for cluster management communications
  • TCP and UDP port 7946 for communication among nodes
  • TCP and UDP port 4789 for overlay network traffic

 
 

firewall-cmd --zone=public --add-port=2377/tcp --permanent

firewall-cmd --zone=public --add-port=4789/tcp --permanent

firewall-cmd --zone=public --add-port=4789/udp --permanent

firewall-cmd --zone=public --add-port=7946/tcp --permanent

firewall-cmd --zone=public --add-port=7946/udp --permanent

 
 

2.初始化 swarm manager  node

[demo@node139 ~]$ docker swarm init --advertise-addr 192.168.190.139

Swarm initialized: current node (cpm3a11fqlvrk5e3xp7zsazum) is now a manager.

 
 

To add a worker to this swarm, run the following command:

 
 

docker swarm join \

--token SWMTKN-1-5osh8sobuw823tdts3unsyww6uj6pu32pqucijtjip1syra6z7-chme7butzz1gdz5s15nl99g2x \

192.168.190.139:2377

 
 

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

 
 

3.查看节点信息

[demo@node139 ~]$ docker node ls

ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS

cpm3a11fqlvrk5e3xp7zsazum * node139 Ready Active Leader

 
 

4.增加一个 swarm worker node

查看worker token,如果加入manater输入 docker swarm join-token manager查看token信息

[demo@node139 ~]$ docker swarm join-token worker

To add a worker to this swarm, run the following command:

 
 

docker swarm join \

--token SWMTKN-1-5osh8sobuw823tdts3unsyww6uj6pu32pqucijtjip1syra6z7-chme7butzz1gdz5s15nl99g2x \

192.168.190.139:2377

 
 

切换到140机器

[demo@node140 ~]$ docker swarm join \

> --token SWMTKN-1-5osh8sobuw823tdts3unsyww6uj6pu32pqucijtjip1syra6z7-chme7butzz1gdz5s15nl99g2x \

> 192.168.190.139:2377

This node joined a swarm as a worker.

 
 

查看节点信息139机器

[demo@node139 ~]$ docker node ls

ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS

9rrk4thpqq06pxo6u7zoomcyw node140 Ready Active

cpm3a11fqlvrk5e3xp7zsazum * node139 Ready Active Leader

 
 

创建网络

[demo@node139 ~]$ docker network create -d overlay mynet

8peggzi7rk1a06g079rtq048r

 
 

 
 

创建服务

 
 

docker service create --replicas 2 --name logapi --network mynet -p 6000:60000 logapi1_0

 
 

挂载目录方式mount参数: docker service create --replicas 4 --name logapi --network mynet --mount type=bind,dst=/var/log/,src=/var/log -p 6000:60000 logapi1_0

 
 

[demo@node139 /]$ docker service create --replicas 4 --name logapi --network mynet -p 6000:60000 logapi1_0

94i7tb0fohz0xuzy69ljw18s9

[demo@node139 /]$ docker service ps logapi

 
 

 
 

[demo@node139 ~]$ docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

fbc336872210 logapi1_0:latest "dotnet YiChe.App.Log" 5 minutes ago Up 5 minutes 60000/tcp logapi.4.b8i17ujd2zqyw7bigchwvfjfo

19a058bce9b4 logapi1_0:latest "dotnet YiChe.App.Log" 5 minutes ago Up 5 minutes 60000/tcp logapi.1.b3gxlsmvtrsl81okyl3ww27lm

 
 

[demo@node140 bin]$ docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

beb939249cfa logapi1_0:latest "dotnet YiChe.App.Log" 6 minutes ago Up 6 minutes 60000/tcp logapi.2.775g8phtr0i9p9xpou29pkk2v

24a1363d1a33 logapi1_0:latest "dotnet YiChe.App.Log" 6 minutes ago Up 6 minutes 60000/tcp logapi.3.6cihlua6w85vddnhuttuseu5i

 
 

访问服务

通过6000端口访问4 次api,结果可以访问

[demo@node139 ~]$ curl http://192.168.190.139:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"fbc336872210","ip":["10.0.1.6","10.0.1.6","10.0.1.6","172.18.0.4","172.18.0.4","172.18.0.4","10.255.0.9","10.255.0.9","10.255.0.9"],"version":null}}[demo@node139 ~]$

[demo@node139 ~]$ curl http://192.168.190.139:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"24a1363d1a33","ip":["10.255.0.8","10.255.0.8","10.255.0.8","172.18.0.3","172.18.0.3","172.18.0.3","10.0.1.5","10.0.1.5","10.0.1.5"],"version":null}}[demo@node139 ~]$

[demo@node139 ~]$ curl http://192.168.190.139:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"beb939249cfa","ip":["10.255.0.7","10.255.0.7","10.255.0.7","172.18.0.4","172.18.0.4","172.18.0.4","10.0.1.4","10.0.1.4","10.0.1.4"],"version":null}}[demo@node139 ~]$

[demo@node139 ~]$ curl http://192.168.190.139:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"19a058bce9b4","ip":["10.255.0.6","10.255.0.6","10.255.0.6","172.18.0.3","172.18.0.3","172.18.0.3","10.0.1.3","10.0.1.3","10.0.1.3"],"version":null}}[demo@node139 ~]$

 
 

[demo@node139 ~]$ curl http://192.168.190.140:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"beb939249cfa","ip":["10.255.0.7","10.255.0.7","10.255.0.7","172.18.0.4","172.18.0.4","172.18.0.4","10.0.1.4","10.0.1.4","10.0.1.4"],"version":null}}[demo@node139 ~]$

[demo@node139 ~]$ curl http://192.168.190.140:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"24a1363d1a33","ip":["10.255.0.8","10.255.0.8","10.255.0.8","172.18.0.3","172.18.0.3","172.18.0.3","10.0.1.5","10.0.1.5","10.0.1.5"],"version":null}}[demo@node139 ~]$

[demo@node139 ~]$ curl http://192.168.190.140:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"19a058bce9b4","ip":["10.255.0.6","10.255.0.6","10.255.0.6","172.18.0.3","172.18.0.3","172.18.0.3","10.0.1.3","10.0.1.3","10.0.1.3"],"version":null}}[demo@node139 ~]$

[demo@node139 ~]$ curl http://192.168.190.140:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"fbc336872210","ip":["10.0.1.6","10.0.1.6","10.0.1.6","172.18.0.4","172.18.0.4","172.18.0.4","10.255.0.9","10.255.0.9","10.255.0.9"],"version":null}}[demo@node139 ~]$

 
 

控制容器数量

[demo@node139 ~]$ docker service scale logapi=2

logapi scaled to 2

[demo@node139 ~]$ docker service ps logapi

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR

b3gxlsmvtrsl81okyl3ww27lm logapi.1 logapi1_0 node139 Running Running 9 minutes ago

775g8phtr0i9p9xpou29pkk2v logapi.2 logapi1_0 node140 Shutdown Shutdown 9 seconds ago

6cihlua6w85vddnhuttuseu5i logapi.3 logapi1_0 node140 Running Running 9 minutes ago

b8i17ujd2zqyw7bigchwvfjfo logapi.4 logapi1_0 node139 Shutdown Shutdown 9 seconds ago

 
 

再次访问4次,只有两个容器ip,符合预期

[demo@node139 ~]$ curl http://192.168.190.140:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"24a1363d1a33","ip":["10.255.0.8","10.255.0.8","10.255.0.8","172.18.0.3","172.18.0.3","172.18.0.3","10.0.1.5","10.0.1.5","10.0.1.5"],"version":null}}[demo@node139 ~]$ curl http://192.168.190.140:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"19a058bce9b4","ip":["10.255.0.6","10.255.0.6","10.255.0.6","172.18.0.3","172.18.0.3","172.18.0.3","10.0.1.3","10.0.1.3","10.0.1.3"],"version":null}}[demo@node139 ~]$ curl http://192.168.190.140:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"24a1363d1a33","ip":["10.255.0.8","10.255.0.8","10.255.0.8","172.18.0.3","172.18.0.3","172.18.0.3","10.0.1.5","10.0.1.5","10.0.1.5"],"version":null}}[demo@node139 ~]$ curl http://192.168.190.140:6000/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"19a058bce9b4","ip":["10.255.0.6","10.255.0.6","10.255.0.6","172.18.0.3","172.18.0.3","172.18.0.3","10.0.1.3","10.0.1.3","10.0.1.3"],"version":null}}[demo@node139 ~]$

 
 

关闭一台机器

 
 

或 docker node update --availability drain node140

节点的管理参考:https://docker.github.io/engine/swarm/manage-nodes/

 
 

[demo@node139 ~]$ docker service ps logapi

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR

b3gxlsmvtrsl81okyl3ww27lm logapi.1 logapi1_0 node139 Running Running 33 minutes ago

775g8phtr0i9p9xpou29pkk2v logapi.2 logapi1_0 node140 Shutdown Shutdown 24 minutes ago

13m72ukox3z12u5vahvzla99h logapi.3 logapi1_0 node139 Running Running 21 minutes ago

6cihlua6w85vddnhuttuseu5i \_ logapi.3 logapi1_0 node140 Shutdown Running 33 minutes ago

b8i17ujd2zqyw7bigchwvfjfo logapi.4 logapi1_0 node139 Shutdown Shutdown 24 minutes ago

 
 

结果显示139机器上运行2个容器

 
 

139机器再次开启后,容器的任务不会自动转回来,这个功能1.12版本还不支持

 
 

配置外网访问

配置nginx文件如下

Docker 1.12 集群

 
 

重新加载nginx

[demo@node140 conf.d]$ sudo nginx -s reload

[demo@node140 conf.d]$ sudo setenforce 0

[demo@node140 conf.d]$ curl http://192.168.190.140/SettingsManager/GetIp

{"status":1,"message":"","data":{"hostName":"562d8d89146e","ip":["10.255.0.7","10.255.0.7","10.255.0.7","172.18.0.6","172.18.0.6","172.18.0.6","10.0.1.4","10.0.1.4","10.0.1.4"],"version":null}}[demo@node140 conf.d]$

 
 

容器升级

[demo@node140 YiChe.App.LogApi]$ docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

logapi2_0 latest 6ed5eef24908 6 seconds ago 269.4 MB

logapi1_0 latest db03033fc5a0 2 days ago 269.4 MB

 
 

[demo@node140 YiChe.App.LogApi]$ docker service ps logapi

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR

b3gxlsmvtrsl81okyl3ww27lm logapi.1 logapi1_0 node139 Shutdown Shutdown about an hour ago

73ugfdrc1gtoveul5pixko27s logapi.2 logapi1_0 node140 Running Running about an hour ago

775g8phtr0i9p9xpou29pkk2v \_ logapi.2 logapi1_0 node140 Shutdown Shutdown 2 hours ago

13m72ukox3z12u5vahvzla99h logapi.3 logapi1_0 node139 Running Running 2 hours ago

6cihlua6w85vddnhuttuseu5i \_ logapi.3 logapi1_0 node140 Shutdown Failed about an hour ago "task: non-zero exit (

b8i17ujd2zqyw7bigchwvfjfo logapi.4 logapi1_0 node139 Shutdown Shutdown 2 hours ago

 
 

升级容器

升级前要把容器先下载到节点上[demo@node140 YiChe.App.LogApi]$ docker service update --image logapi2_0 logapi

logapi

[demo@node140 YiChe.App.LogApi]$ docker service ps logapi

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR

b3gxlsmvtrsl81okyl3ww27lm logapi.1 logapi1_0 node139 Shutdown Shutdown about an hour ago

73ugfdrc1gtoveul5pixko27s logapi.2 logapi1_0 node140 Running Running about an hour ago

775g8phtr0i9p9xpou29pkk2v \_ logapi.2 logapi1_0 node140 Shutdown Shutdown 2 hours ago

atwtihzoja4tu78wptq2ohb7u logapi.3 logapi2_0 node140 Running Preparing 12 seconds ago

13m72ukox3z12u5vahvzla99h \_ logapi.3 logapi1_0 node139 Shutdown Shutdown 11 seconds ago

6cihlua6w85vddnhuttuseu5i \_ logapi.3 logapi1_0 node140 Shutdown Failed about an hour ago "task: non-zero exit (1)"

只有一台升级完成,升过程需要一些时间

 
 

 
 

挂载目录,mount

--mount type=volume,src=<VOLUME-NAME>,dst=<CONTAINER-PATH>,volume-driver=<DRIVER>,volume-opt=<KEY0>=<VALUE0>,volume-opt=<KEY1>=<VALUE1>

 
 

target或dst = 容器里面的路径, source或src =
本地硬盘路径

修改已有服务,添加挂载目录,创建服务时用--mount参数

docker service update logapi --mount-add type=bind,target=/var/log/,source=/var/log

 
 

 
 

 
 

查看服务信息

[demo@node139 ~]$ docker service inspect logapi

[

{

"ID": "8nmmguchzhz34i6onuijdmy94",

"Version": {

"Index": 39

},

"CreatedAt": "2016-10-26T18:43:07.480086156Z",

"UpdatedAt": "2016-10-26T18:43:07.485602124Z",

"Spec": {

"Name": "logapi",

"TaskTemplate": {

"ContainerSpec": {

"Image": "logapi1_0"

},

"Resources": {

"Limits": {},

"Reservations": {}

},

"RestartPolicy": {

"Condition": "any",

"MaxAttempts": 0

},

"Placement": {}

},

"Mode": {

"Replicated": {

"Replicas": 4

}

},

"UpdateConfig": {

"Parallelism": 1,

"FailureAction": "pause"

},

"Networks": [

{

"Target": "8peggzi7rk1a06g079rtq048r"

}

],

"EndpointSpec": {

"Mode": "vip"

}

},

"Endpoint": {

"Spec": {

"Mode": "vip"

},

"VirtualIPs": [

{

"NetworkID": "8peggzi7rk1a06g079rtq048r",

"Addr": "10.0.1.2/24"

}

]

},

"UpdateStatus": {

"StartedAt": "0001-01-01T00:00:00Z",

"CompletedAt": "0001-01-01T00:00:00Z"

}

}

]

 
 

 
 

先创建一个同样使用mynet的overlay网络 的服务

 
 

[demo@node139 ~]$ docker service create --name my-busybox --network mynet busybox sleep 3000

194l7kv87mffdn4nh1db1mcia

 
 

等待服务启动后, 用docker exec 连接进busybox的容器里

 
 

[demo@node139 ~]$ docker service ps my-busybox

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR

csk8n7jaxbd91mft20wngcmke my-busybox.1 busybox node139 Running Running about a minute ago

[demo@node139 ~]$ docker ps -a | grep my-busybox

23b3023dbbbe busybox:latest "sleep 3000" About a minute ago Up About a minute my-busybox.1.csk8n7jaxbd91mft20wngcmke

 
 

[demo@node139 ~]$ docker exec -it 23b3023dbbbe sh

# nslookup logapi

Server: 127.0.0.11

Address 1: 127.0.0.11

 
 

Name: logapi

Address 1: 10.0.1.2

/ # nslookup tasks.logapi

Server: 127.0.0.11

Address 1: 127.0.0.11

 
 

Name: tasks.logapi

Address 1: 10.0.1.5 logapi.2.amnpfq3m3cfuric8obztn17zt.mynet

Address 2: 10.0.1.6 logapi.3.1qicmzulf9fbf4lpvcns5xno0.mynet

Address 3: 10.0.1.4 logapi.1.5vqhxhee0jfqq45lsmc1w0lw8.mynet

Address 4: 10.0.1.3 logapi.4.9fxx2jswq4zkp25uk9rno1cq2.mynet

 
 

分别ping 虚拟ip和服务对应的4个ip 都是通的

 
 

# ping 10.0.1.2

PING 10.0.1.2 (10.0.1.2): 56 data bytes

64 bytes from 10.0.1.2: seq=0 ttl=64 time=1.734 ms

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 

Docker 1.12 集群的更多相关文章

  1. Docker 搭建 etcd 集群

    阅读目录: 主机安装 集群搭建 API 操作 API 说明和 etcdctl 命令说明 etcd 是 CoreOS 团队发起的一个开源项目(Go 语言,其实很多这类项目都是 Go 语言实现的,只能说很 ...

  2. Docker部署Elasticsearch集群

    http://blog.sina.com.cn/s/blog_8ea8e9d50102wwik.html Docker部署Elasticsearch集群 参考文档: https://hub.docke ...

  3. docker 实现redis集群搭建

    摘要:接触docker以来,似乎养成了一种习惯,安装什么应用软件都想往docker方向做,今天就想来尝试下使用docker搭建redis集群. 首先,我们需要理论知识:Redis Cluster是Re ...

  4. Docker Swarm部署集群

    一.Swarm简介 Swarm是Docker的一个编排工具,参考官网:https://docs.docker.com/engine/swarm/ Swarm 模式简介 要在Swarm模式下运行dock ...

  5. 使用Docker搭建Spark集群(用于实现网站流量实时分析模块)

    上一篇使用Docker搭建了Hadoop的完全分布式:使用Docker搭建Hadoop集群(伪分布式与完全分布式),本次记录搭建spark集群,使用两者同时来实现之前一直未完成的项目:网站日志流量分析 ...

  6. 使用Docker搭建Hadoop集群&lpar;伪分布式与完全分布式&rpar;

    之前用虚拟机搭建Hadoop集群(包括伪分布式和完全分布式:Hadoop之伪分布式安装),但是这样太消耗资源了,自学了Docker也来操练一把,用Docker来构建Hadoop集群,这里搭建的Hado ...

  7. 庐山真面目之十二微服务架构基于Docker搭建Consul集群、Ocelot网关集群和IdentityServer版本实现

    庐山真面目之十二微服务架构基于Docker搭建Consul集群.Ocelot网关集群和IdentityServer版本实现 一.简介      在第七篇文章<庐山真面目之七微服务架构Consul ...

  8. Docker部署Hadoop集群

    Docker部署Hadoop集群 2016-09-27 杜亦舒 前几天写了文章"Hadoop 集群搭建"之后,一个朋友留言说希望介绍下如何使用Docker部署,这个建议很好,Doc ...

  9. docker安装hadoop集群

    docker安装hadoop集群?图啥呢?不图啥,就是图好玩.本篇博客主要是来教大家如何搭建一个docker的hadoop集群.不要问 为什么我要做这么无聊的事情,答案你也许知道,因为没有女票.... ...

随机推荐

  1. Manifesto – HTML5 离线应用程序缓存校验工具

    Manifesto 是一个 HTML5 离线应用程序缓存校验工具,提供了快速校验 HTML5 manifest 文件有效性的方法.离线应用程序缓存在使用中最困难的部分之一就是无法正常工作的时候没有明显 ...

  2. Java计算程序运行时间

    public static void main(String[] args) { // TODO Auto-generated method stub long nd = 1000 * 24 * 60 ...

  3. mac 下修改Hosts文件

    最近Google网站老是打不开,具体原因大家都明白,不过修改Hosts文件后,就能访问了,也算不上原创,网上一搜就能找到,自己操作记录下,希望有刚接触Mac 系统的童鞋有帮助. 第一步:打开Finde ...

  4. php 扩展dll

    一.准备工作: 注:php5.2没有vc9,php5.3.php5.4没有vc6.呵呵.PHP5.5开始,不支持xp和win2003了,更是vc11了.--------------->所以,扩展 ...

  5. C&plus;&plus;&sol;CLR Sqlite初探

        error C2491: "acosh": 不允许 dllimport 函数 的定义     asinh": 不允许 dllimport 函数 的定义     a ...

  6. PHP设计模式之工厂模式&lpar;权限分配&rpar;

    // 抽象基类 User abstract class User{ protected $name = NULL; // 构造函数 function User($name){ $this->na ...

  7. iOS多用连接、反向协议、安全

    资源 WWDC-2013-Session-708 BlackHat-US-2014-"It Just (Net)works" Understanding Multipeer Con ...

  8. hdu 3076 ssworld VS DDD &lpar;概率dp&rpar;

    ///题意: /// A,B掷骰子,对于每一次点数大者胜,平为和,A先胜了m次A赢,B先胜了n次B赢. ///p1表示a赢,p2表示b赢,p=1-p1-p2表示平局 ///a赢得概率 比一次p1 两次 ...

  9. LAMP一键安装

    author:JevonWei 版权声明:原创作品 #!/bin/bash 定义变量 export MDB=$(rpm -qa *mariadb*) export HTT=$(rpm -qa *htt ...

  10. php函数 array&lowbar;combine

    (PHP 5, PHP 7) array_combine — 创建一个数组,用一个数组的值作为其键名,另一个数组的值作为其值 array_combine ( array $keys , array $ ...