码迷,mamicode.com
首页 > 其他好文 > 详细

EdgeX Foundry初体验(二)--安装部署(用户篇)

时间:2020-06-17 10:35:00      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:fast   serve   mic   point   fas   拉取   linux   device   container   

 技术图片

=====1. 环境设置 ======

OS: CentOS Linux release 7.8.2003 (Core)

IP:  192.168.0.133/24

=====2. 应用设置======

A)安装Docker 和Docker Compose:

docker-ce的安装前如果存在系统自带的docker,且版本较低,可以使用下面命令删除旧版本

yum remove docker docker-common docker-selinux docker-engine

更新yum包

sudo yum update

 安装需要的软件包

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

添加软件源信息

sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 

更新安装docker-ce

sudo yum makecache fast
sudo yum -y install docker-ce

开启docker-ce

sudo systemctel restart docker
sudo systemctl enable docker
# 注意:
# 官方软件源默认启用了最新的软件,您可以通过编辑软件源的方式获取各个版本的软件包。例如官方并没有将测试版本的软件源置为可用,您可以通过以下方式开启。同理可以开启各种测试版本等。
# vim /etc/yum.repos.d/docker-ee.repo
#   将[docker-ce-test]下方的enabled=0修改为enabled=1
#
# 安装指定版本的Docker-CE:
# Step 1: 查找Docker-CE的版本:
# yum list docker-ce.x86_64 --showduplicates | sort -r
#   Loading mirror speeds from cached hostfile
#   Loaded plugins: branch, fastestmirror, langpacks
#   docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable
#   docker-ce.x86_64            17.03.1.ce-1.el7.centos            @docker-ce-stable
#   docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable
#   Available Packages
# Step2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.0.ce.1-1.el7.centos)
# sudo yum -y install docker-ce-[VERSION] 

使用docker version验证docker安装成功:

~]# docker version
Client: Docker Engine - Community
 Version:           19.03.11
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        42e35e61f3
 Built:             Mon Jun  1 09:13:48 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.11
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       42e35e61f3
  Built:            Mon Jun  1 09:12:26 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

  

Docker-compose的安装:

更新软件源

yum -y install epel-release
yum -y install python-pip

安装docker-compose

pip install docker-compose

 验证docker-compose安装成功

~]# docker-compose version
docker-compose version 1.26.0, build unknown
docker-py version: 4.2.1
CPython version: 3.8.2
OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017

 

=====3. EdgeX 部署======

A) 访问下载地址:https://github.com/edgexfoundry/developer-scripts/tree/master/releases

查看使用哪个版本的compose-file文件:此例子使用 EdgeX Foundry, Delhi, version 0.7.1  也就是下图中顺序第三个delhi/compose-files

技术图片

下载文件:docker-compose-delhi-0.7.1.yml(此文件中包含了运行edgex的所有核心镜像)

技术图片

 

 

 

 B) 下载此文件内容到文件docker-compose.yml中(此例默认放在/root中)

 ~]# ll
total 16
-rw-------. 1 root root  1249  anaconda-ks.cfg
-rw-r--r--. 1 root root 11419  docker-compose.yml
~]# pwd
/root

C) 由于你懂的原因,这里添加加速器:

此例采用的是daocloud的加速器,具体可以参考:https://www.daocloud.io/mirror

Linux环境使用下面的脚本:

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

D)查看要下周的核心镜像和拉取下载镜像

查看要下载的镜像名称

~]# docker-compose config --services
volume
consul
config-seed
mongo
logging
notifications
metadata
data
command
scheduler
export-client
export-distro
rulesengine
device-virtual
ui
portainer

拉取下载镜像:(全部一定要为done)

说明:Pulls images for services defined in a Compose file, but does not start the containers.

这里只是拉取镜像,但是并未启动镜像

~]# docker-compose pull 
Pulling volume         ... done
Pulling consul         ... done
Pulling config-seed    ... done
Pulling mongo          ... done
Pulling logging        ... done
Pulling notifications  ... done
Pulling metadata       ... done
Pulling data           ... done
Pulling command        ... done
Pulling scheduler      ... done
Pulling export-client  ... done
Pulling export-distro  ... done
Pulling rulesengine    ... done
Pulling device-virtual ... done
Pulling ui             ... done
Pulling portainer      ... done

E)启动镜像

注意-d 选项表示 Docker Compose 以分离模式运行 EdgeX 容器(即在后台运行容器)如果没有 -d,容器将在终端运行。如果后续想要使用终端,必须先停止容器。

~]# docker-compose up -d
Starting edgex-files               ... done
Starting edgex-support-rulesengine ... done
Starting edgex-mongo               ... done
Starting edgex-core-consul         ... done
Starting root_portainer_1          ... done
Starting edgex-config-seed         ... done
Starting edgex-support-logging     ... done
Starting edgex-support-notifications ... done
Starting edgex-core-metadata         ... done
Starting edgex-core-data             ... done
Starting edgex-export-client         ... done
Starting edgex-support-scheduler     ... done
Starting edgex-core-command          ... done
Starting edgex-export-distro         ... done
Starting edgex-device-virtual        ... done

F)(选看内容)如果不使用edgex了的时候可以关闭镜像

~]# docker-compose stop
Stopping edgex-export-distro         ... done
Stopping edgex-device-virtual        ... done
Stopping edgex-export-client         ... done
Stopping edgex-support-scheduler     ... done
Stopping edgex-core-command          ... done
Stopping edgex-support-notifications ... done
Stopping edgex-core-data             ... done
Stopping edgex-core-metadata         ... done
Stopping edgex-support-logging       ... done
Stopping edgex-mongo                 ... done
Stopping root_portainer_1            ... done
Stopping edgex-core-consul           ... done
Stopping edgex-support-rulesengine   ... done
Stopping edgex-files                 ... done

G)(选看内容)如果彻底不使用edgex了的时候可以删除镜像(谨慎操作)

Stop and remove containers, networks, images, and volumes~]# docker-compose down
~]# docker-compose down

H) 接上面的E, 启动以后验证镜像容器启动情况:

docker-compose ps -a
或者 docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}\t{{.RunningFor}}" 

如下:edgex-config-seed 在启动后不久就会更改状态为Exit 0(这是正常情况,暂时不用管)

~]# docker-compose ps -a
           Name                          Command               State                                                                  Ports                                                               
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
edgex-config-seed             /bin/sh -c /edgex/cmd/conf ...   Exit 0                                                                                                                                     
edgex-core-command            /core-command --consul --p ...   Up       0.0.0.0:48082->48082/tcp                                                                                                          
edgex-core-consul             docker-entrypoint.sh agent ...   Up       8300/tcp, 8301/tcp, 8301/udp, 8302/tcp, 8302/udp, 0.0.0.0:8400->8400/tcp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8600->8600/tcp, 8600/udp
edgex-core-data               /core-data --consul --prof ...   Up       0.0.0.0:48080->48080/tcp, 0.0.0.0:5563->5563/tcp                                                                                  
edgex-core-metadata           /core-metadata --consul -- ...   Up       0.0.0.0:48081->48081/tcp, 48082/tcp                                                                                               
edgex-device-virtual          /bin/sh -c java -jar -Djav ...   Up       0.0.0.0:49990->49990/tcp                                                                                                          
edgex-export-client           /export-client --consul -- ...   Up       0.0.0.0:48071->48071/tcp                                                                                                          
edgex-export-distro           /export-distro --consul -- ...   Up       0.0.0.0:48070->48070/tcp, 0.0.0.0:5566->5566/tcp                                                                                  
edgex-files                   /bin/sh -c /usr/bin/tail - ...   Up                                                                                                                                         
edgex-mongo                   docker-entrypoint.sh /bin/ ...   Up       0.0.0.0:27017->27017/tcp                                                                                                          
edgex-support-logging         /support-logging --consul  ...   Up       0.0.0.0:48061->48061/tcp                                                                                                          
edgex-support-notifications   /support-notifications --c ...   Up       0.0.0.0:48060->48060/tcp                                                                                                          
edgex-support-rulesengine     /bin/sh -c java -jar -Djav ...   Up       0.0.0.0:48075->48075/tcp                                                                                                          
edgex-support-scheduler       /support-scheduler --consu ...   Up       0.0.0.0:48085->48085/tcp                                                                                                          
root_portainer_1              /portainer -H unix:///var/ ...   Up       0.0.0.0:9000->9000/tcp

 通过GUI界面查看服务的情况:

在启动的服务中有一个consul服务(看下面红色标注的端口):

edgex-core-consul             docker-entrypoint.sh agent ...   Up       8300/tcp, 8301/tcp, 8301/udp, 8302/tcp, 8302/udp, 0.0.0.0:8400->8400/tcp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8600->8600/tcp, 8600/udp

 在浏览器输入本机IP(192.168.0.133)访问: http://192.168.0.133:8500

技术图片

 

 

到此 edgex的核心服务安装部署完毕。

 

 

********************************************************************************

附录:如果需要跟踪容器的日志,使用docker

~]# docker ps -a
6d5dbc2db5ba        edgexfoundry/docker-core-config-seed-go:0.7.1        "/bin/sh -c ‘/edgex/…"   6 days ago          Exited (0) About an hour ago                                                                                                                    edgex-config-seed
d9571ba3ad7d        edgexfoundry/docker-edgex-mongo:0.6.0                "docker-entrypoint.s…"   6 days ago          Up About an hour               0.0.0.0:27017->27017/tcp                                                                                         edgex-mongo
8bd57e9d5699        portainer/portainer                                  "/portainer -H unix:…"   6 days ago          Exited (1) About an hour ago                                                                                                                    root_portainer_1
3d6a90a0645f        consul:1.1.0                                         "docker-entrypoint.s…"   6 days ago          Up About an hour               0.0.0.0:8400->8400/tcp, 8301-8302/udp, 0.0.0.0:8500->8500/tcp, 8300-8302/tcp, 8600/udp, 0.0.0.0:8600->8600/tcp   edgex-core-consul
a8e1f475c2a9        edgexfoundry/docker-support-rulesengine:0.7.0        "/bin/sh -c ‘java -j…"   6 days ago          Up About an hour               0.0.0.0:48075->48075/tcp                                                                                         edgex-support-rulesengine
b1c150571d8b        edgexfoundry/docker-edgex-volume:0.6.0               "/bin/sh -c ‘/usr/bi…"   6 days ago          Up About an hour
~]# docker logs -f d9571ba3ad7d
2020-06-10T12:31:50.021+0000 I ACCESS [conn19] Successfully authenticated as principal logging on logging 2020-06-10T12:31:54.216+0000 I NETWORK [thread1] connection accepted from 172.18.0.4:47838 #1496 (21 connections now open) 2020-06-10T12:31:54.217+0000 I - [conn1496] end connection 172.18.0.4:47838 (21 connections now open) 2020-06-10T12:32:00.487+0000 I ACCESS [conn27] Successfully authenticated as principal meta on metadata 2020-06-10T12:32:02.477+0000 I ACCESS [conn749] Successfully authenticated as principal core on coredata 2020-06-10T12:32:04.217+0000 I NETWORK [thread1] connection accepted from 172.18.0.4:48104 #1497 (21 connections now open) 2020-06-10T12:32:04.218+0000 I - [conn1497] end connection 172.18.0.4:48104 (21 connections now open) 2020-06-10T12:32:05.018+0000 I ACCESS [conn31] Successfully authenticated as principal logging on logging 2020-06-10T12:32:14.218+0000 I NETWORK [thread1] connection accepted from 172.18.0.4:48346 #1498 (21 connections now open) 2020-06-10T12:32:14.219+0000 I - [conn1498] end connection 172.18.0.4:48346 (21 connections now open) 2020-06-10T12:32:15.502+0000 I ACCESS [conn27] Successfully authenticated as principal meta on metadata 2020-06-10T12:32:17.476+0000 I ACCESS [conn30] Successfully authenticated as principal core on coredata 2020-06-10T12:32:20.019+0000 I ACCESS [conn66] Successfully authenticated as principal logging on logging 2020-06-10T12:32:24.220+0000 I NETWORK [thread1] connection accepted from 172.18.0.4:48614 #1499 (21 connections now open)

或者使用docker-compose

 ~]# docker-compose ps 
           Name                          Command               State                                                                  Ports                                                               
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
edgex-config-seed             /bin/sh -c /edgex/cmd/conf ...   Exit 0                                                                                                                                     
edgex-core-command            /core-command --consul --p ...   Up       0.0.0.0:48082->48082/tcp                                                                                                          
edgex-core-consul             docker-entrypoint.sh agent ...   Up       8300/tcp, 8301/tcp, 8301/udp, 8302/tcp, 8302/udp, 0.0.0.0:8400->8400/tcp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8600->8600/tcp, 8600/udp
edgex-core-data               /core-data --consul --prof ...   Up       0.0.0.0:48080->48080/tcp, 0.0.0.0:5563->5563/tcp                                                                                  
edgex-core-metadata           /core-metadata --consul -- ...   Up       0.0.0.0:48081->48081/tcp, 48082/tcp                                                                                               
edgex-device-virtual          /bin/sh -c java -jar -Djav ...   Up       0.0.0.0:49990->49990/tcp                                                                                                          
edgex-export-client           /export-client --consul -- ...   Up       0.0.0.0:48071->48071/tcp                                                                                                          
edgex-export-distro           /export-distro --consul -- ...   Up       0.0.0.0:48070->48070/tcp, 0.0.0.0:5566->5566/tcp                                                                                  
edgex-files                   /bin/sh -c /usr/bin/tail - ...   Up                                                                                                                                         
edgex-mongo                   docker-entrypoint.sh /bin/ ...   Up       0.0.0.0:27017->27017/tcp                                                                                                          
edgex-support-logging         /support-logging --consul  ...   Up       0.0.0.0:48061->48061/tcp                                                                                                          
edgex-support-notifications   /support-notifications --c ...   Up       0.0.0.0:48060->48060/tcp                                                                                                          
edgex-support-rulesengine     /bin/sh -c java -jar -Djav ...   Up       0.0.0.0:48075->48075/tcp                                                                                                          
edgex-support-scheduler       /support-scheduler --consu ...   Up       0.0.0.0:48085->48085/tcp                                                                                                          
root_portainer_1              /portainer -H unix:///var/ ...   Exit 1 

~]# docker-compose logs -f mongo
edgex-mongo | 2020-06-10T08:48:32.516+0000 I - [conn152] end connection 172.18.0.4:35464 (17 connections now open) edgex-mongo | 2020-06-10T08:48:39.969+0000 I ACCESS [conn31] Successfully authenticated as principal logging on logging edgex-mongo | 2020-06-10T08:48:42.516+0000 I NETWORK [thread1] connection accepted from 172.18.0.4:35692 #153 (17 connections now open) edgex-mongo | 2020-06-10T08:48:42.517+0000 I - [conn153] end connection 172.18.0.4:35692 (17 connections now open) edgex-mongo | 2020-06-10T08:48:45.495+0000 I ACCESS [conn29] Successfully authenticated as principal core on coredata edgex-mongo | 2020-06-10T08:48:45.517+0000 I ACCESS [conn23] Successfully authenticated as principal meta on metadata edgex-mongo | 2020-06-10T08:48:47.483+0000 I ACCESS [conn29] Successfully authenticated as principal core on coredata edgex-mongo | 2020-06-10T08:48:52.517+0000 I NETWORK [thread1] connection accepted from 172.18.0.4:35962 #154 (17 connections now open) edgex-mongo | 2020-06-10T08:48:52.518+0000 I - [conn154] end connection 172.18.0.4:35962 (17 connections now open) edgex-mongo | 2020-06-10T08:49:00.468+0000 I ACCESS [conn66] Successfully authenticated as principal logging on logging edgex-mongo | 2020-06-10T08:49:00.503+0000 I ACCESS [conn23] Successfully authenticated as principal meta on metadata edgex-mongo | 2020-06-10T08:49:02.486+0000 I ACCESS [conn30] Successfully authenticated as principal core on coredata

 

EdgeX Foundry初体验(二)--安装部署(用户篇)

标签:fast   serve   mic   point   fas   拉取   linux   device   container   

原文地址:https://www.cnblogs.com/horizonli/p/13140680.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!