没有合适的资源?快使用搜索试试~ 我知道了~
首页edgexfoundry手册
edgexfoundry手册
需积分: 44 1.1k 浏览量
更新于2023-05-29
评论 1
收藏 752KB PDF 举报
edgex foundry使用手册,包括安装,api调用,服务讲解,适用于初学者,快速了解exgex foundry的使用
资源详情
资源评论
资源推荐

1
Getting Started with EdgeX Foundry Hands-On Lab
2/21/18, v1
Contents
Lab 1 – Getting and running EdgeX Foundry ................................................................................................ 2
Prerequisite ............................................................................................................................................... 2
A. Download the EdgeX Foundry Docker Compose file ........................................................................ 2
B. Pull all the EdgeX Foundry Docker images ........................................................................................ 3
C. Start EdgeX ........................................................................................................................................ 4
D. Test EdgeX ......................................................................................................................................... 4
Finished Early? .............................................................................................................................................. 5
Bonus1. Check out a micro service log ..................................................................................................... 5
Bonus2. Replace a Go Micro Service with a Java Micro Service ............................................................... 6
Bonus3. Checking Docker Stats ................................................................................................................ 7
Bonus4. Checking out Mongo ................................................................................................................... 7
Lab 2 – Exploring EdgeX Core Services .......................................................................................................... 9
A. Explore readings and events through Core Data .............................................................................. 9
B. Understanding Value Descriptors in Core Data .............................................................................. 10
C. Looking at the relationship between Devices, Device Profiles and Device Services in Metadata .. 11
D. Re-exploring Value Descriptors through Metadata ........................................................................ 13
E. Executing actuation through the Command micro service ............................................................ 13
F. Exploring micro service status through Consul (the Config/Registry micro service) ...................... 15
G. Micro Service configuration seen through Consul .......................................................................... 16
Lab 3 – Exploring EdgeX Device Services .................................................................................................... 18
A. Call on the Device Service API ......................................................................................................... 18
B. Look at the Virtual Device configuration ........................................................................................ 19
C. Exploring the DS SDK ....................................................................................................................... 21
Lab 4 – Exploring EdgeX Export Services ..................................................................................................... 22
A. Use Export Client to register a client .............................................................................................. 22
B. See Data flow through distro .......................................................................................................... 24

2
Getting Started with EdgeX Foundry Hands-On Lab
2/21/18, v1
Lab 1 – Getting and running EdgeX Foundry
Prerequisite
Assumption: you already have Docker (Community Edition) and Docker Compose installed on your
laptop or workstation.
• To get Docker, go to https://docs.docker.com/install/
• To get Docker Compose, go to https://docs.docker.com/compose/install/ [Note, on Mac and
Windows, Docker Compose is installed with Docker].
Test that your Docker and Docker Compose environments are working correctly. Run the following
commands from a terminal or Docker Terminal (depending on your installation) to insure you have
installed Docker & Docker Compose correctly.
• docker version
• docker-compose version
A. Download the EdgeX Foundry Docker Compose file
1. Open a browser and go to the following URL:
https://wiki.edgexfoundry.org/display/FA/California+Preview
2. At the bottom of this wiki page, click on the latest version of the California Preview Docker
Compose file link (at the time of this writing it was version 0.5.1)
3. When you click on the link, it will take you to the GitHub account containing the Docker
Compose file, push the “Raw” button to see the raw contents of the YAML file and then select
File -> Save Page As… from your browser menu to save the contents to your hard drive. Save
the docker-compose file into a directory location that is easy to remember and easy to get to
from a command prompt.

3
Getting Started with EdgeX Foundry Hands-On Lab
2/21/18, v1
4. Once the file is copied to your directory location of choice, remain the compose file to docker-
compose.yml.
By default, Docker Compose will look for and use the file docker-compose.yml in the current
directory for all commands. You can use the -f option to specify a file name other than docker-
compose.yml.
B. Pull all the EdgeX Foundry Docker images
1. Open a terminal (Linux, Mac) or Docker Terminal (Windows).
2. Change directories to the directory containing the Docker Compose file downloaded in step A.
3. Login to EdgeX Foundry’s Nexus repository holding some of the Docker images you will need.
Login as shown below
docker login nexus3.edgexfoundry.org:10004
The username and password are both docker.
Note that the Docker images for the latest release of EdgeX’s are in Docker Hub. However, to
get the latest development images currently being worked on, you will need to access the EdgeX
Nexus repository – thus the reason you provide the login credentials. The latest images include
Go Lang micro service images which are much smaller and faster than the original Java-based
EdgeX micro services.
4. From the directory holding the docker-compose YAML, request to pull the EdgeX containers
specified by the Docker Compose manifest by using the Docker Compose pull command.
docker-compose pull
It will take several minutes for all the images to get pulled down to your system. You can watch
as each container image is downloaded.

4
Getting Started with EdgeX Foundry Hands-On Lab
2/21/18, v1
C. Start EdgeX
1. In the terminal (Linux, Mac) or Docker Terminal, start each EdgeX Docker Container using the
docker-compose up command. The table below specifies the exact commands to start each
container and the amount of time you should wait before starting the next container. There are
a few micro services in EdgeX that are dependent on the availability of another micro service. If
you fail to wait the allotted time, a micro service may not start correctly because its dependent
is not ready.
EdgeX Container start command to execute
Time to wait before
starting the next
container
Micro Service
docker-compose up -d volume
2 sec
File system
docker-compose up -d config-seed
2 sec
Consul
docker-compose up -d mongo
10 sec
MongoDB
docker-compose up -d logging
60 sec
Support Logging
docker-compose up -d notifications
30 sec
Support Notifications
docker-compose up -d metadata
2 sec
Core Metadata
docker-compose up -d data
2 sec
Core Data
docker-compose up -d command
2 sec
Core Command
docker-compose up -d export-client
2 sec
Export Client
docker-compose up -d export-distro
2 sec
Export Distro
docker-compose up -d device-virtual
60 sec
Virtual Device Service
You’ll learn later in class what each of these containers do.
2. Give the last container (device-virtual) about 60 seconds to start. Then check the Docker
process status to see that all of your EdgeX containers are up and running. The command to get
the process status is docker-compose ps as shown below. Check the “State” column to see that
all your containers are up and running.
D. Test EdgeX
In the next set of labs, you will explore all of the micro services and inspect the APIs and functionality
surrounding each one. For now, you are going to make two simple tests to insure everything is working
properly.
1. EdgeX uses an open source registry service called Consul. All the micro services are expected to
register with Consul when they start up. After registering, Consul routinely calls on the micro
services to check that they are still operational. Consul has a graphical user interface we can use
to see if the micro services are all running. Open a browser and enter the following URL –
http://<docker host address>:8500. If everything is up and running, your browser screen should
have a display that looks similar to that below.

5
Getting Started with EdgeX Foundry Hands-On Lab
2/21/18, v1
The docker host address varies per platform. Below is a list of the common IP addresses for
your docker host. Ask your instructor if you need help locating the IP address for your Docker
containers.
OS
Docker Host Address
Windows
192.168.99.100
Mac
192.168.99.100
Linux
172.17.0.1 (localhost also works)
2. Next, you can check the number of records being created by the Virtual Device Service which
are sent into EdgeX. In the browser, enter the following URL – http://<docker host
address>:48080/api/v1/event/count. The browser should display a number of Events so far
processed by EdgeX as shown below. You will learn what an Event in the next chapter of class.
Finished Early?
If you complete the steps of this lab and you are looking to try learn a little more about EdgeX, try these
extra steps
Bonus1. Check out a micro service log
Each micro service produces logs. Those logs are sent to a Logging micro service where they can be
persisted in a database or file. The logs are also kept by each Docker container. Let’s look at a log
produced by a micro service using Docker (and Docker Compose). You can use this trick when you are
trying to quickly debug what’s going on in a micro service.
1. In the terminal (Linux, Mac) or Docker Terminal, type the following command
docker-compose logs -f --tail=100 metadata
You must hit Ctrl-C to exit the tail of the logs.
2. What do you see from the log? Metadata is one of the EdgeX micro services. Try replacing
metadata with one of the other service names (see the table in Step C.1. for a list of the micro
剩余25页未读,继续阅读














安全验证
文档复制为VIP权益,开通VIP直接复制

评论0