【愚公系列】2023年01月 Dapr分布式应用运行时-Dapr的安装
【摘要】 前言Dapr 是一个可移植的事件驱动运行时,使任何开发人员都可以轻松构建可复原的、 在云和边缘上运行的无状态和有状态应用程序,并包含 语言和开发人员框架。利用挎斗架构的优势,Dapr 帮助 您可以应对构建微服务带来的挑战,并使代码平台不可知。 一、Dapr的安装 1.window安装1、安装Daprwind11可以直接使用如下命令安装winget install Dapr.CLIwinge...
前言
Dapr 是一个可移植的事件驱动运行时,使任何开发人员都可以轻松构建可复原的、 在云和边缘上运行的无状态和有状态应用程序,并包含 语言和开发人员框架。利用挎斗架构的优势,Dapr 帮助 您可以应对构建微服务带来的挑战,并使代码平台不可知。
一、Dapr的安装
1.window安装
1、安装Dapr
wind11可以直接使用如下命令安装
winget install Dapr.CLI
winget install Dapr.CLI.Preview
其他window系统MSI安装程序安装
Dapr CLI 的每个版本还包括一个 Windows 安装程序。您可以手动下载 MSI:
- 从最新的 Dapr 版本下载 MSI 程序包。dapr.msi
- 导航到下载的 MSI 文件,然后双击该文件以运行它。
- 按照安装提示接受许可证和安装目录。所选文件夹将添加到用户 PATH 环境变量中。默认值设置为 。$Env:SystemDrive\dapr
- 单击以开始安装。安装完成后,您将看到最后一条消息。Install
2、校验Dapr安装成功
dapr
2.liunx安装
2.1 官方脚本安装
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash
通过重新启动终端/命令提示符并运行以下命令来验证 CLI 是否已安装:
dapr
__
____/ /___ _____ _____
/ __ / __ '/ __ \/ ___/
/ /_/ / /_/ / /_/ / /
\__,_/\__,_/ .___/_/
/_/
===============================
Distributed Application Runtime
Usage:
dapr [command]
Available Commands:
completion Generates shell completion scripts
components List all Dapr components. Supported platforms: Kubernetes
configurations List all Dapr configurations. Supported platforms: Kubernetes
dashboard Start Dapr dashboard. Supported platforms: Kubernetes and self-hosted
help Help about any command
init Install Dapr on supported hosting platforms. Supported platforms: Kubernetes and self-hosted
invoke Invoke a method on a given Dapr application. Supported platforms: Self-hosted
list List all Dapr instances. Supported platforms: Kubernetes and self-hosted
logs Get Dapr sidecar logs for an application. Supported platforms: Kubernetes
mtls Check if mTLS is enabled. Supported platforms: Kubernetes
publish Publish a pub-sub event. Supported platforms: Self-hosted
run Run Dapr and (optionally) your application side by side. Supported platforms: Self-hosted
status Show the health status of Dapr services. Supported platforms: Kubernetes
stop Stop Dapr instances and their associated apps. . Supported platforms: Self-hosted
uninstall Uninstall Dapr runtime. Supported platforms: Kubernetes and self-hosted
upgrade Upgrades a Dapr control plane installation in a cluster. Supported platforms: Kubernetes
Flags:
-h, --help help for dapr
-v, --version version for dapr
Use "dapr [command] --help" for more information about a command.
2.2 二进制文件安装
下载二进制文件网址:https://github.com/dapr/cli/releases
下载完执行如下命令就ok
tar zxvf dapr_linux_amd64.tar.gz
mv dapr /usr/local/bin
3.初始化Dapr
dapr初始化可以在线,也可以离线
以管理员方式启动powershell
dapr uninstall 卸载 先卸载一下,以防有残留
1、在线初始化
powershell执行dapr init
执行成功后可以看到 在 C:\用户\用户名.dapr\ (注:用户名为自己电脑的名字)
2.离线初始化
离线初始话需要下载两个压缩文件
dashboard文件
daprd文件
①. 先在powershell执行dapr init因为网络问题失败也没关系,这里只是让他生成 components和config.yaml文件
②. dapr uninstall 卸载
③. 在 C:\用户\用户名.dapr\ 这个目录下新建 bin目录把两个文件解压后放到bin目录
④. 这时候在powershell上执行 dapr -v 就会发现 CLI和Runtime 都有版本号了
⑤. 在环境变量里面添加 C:\用户\用户名.dapr\ 目录配置
到这里就已经全部安装完成了。有的小伙伴可能在Github下载文件很慢。这里推荐用http://toolwa.com/github/ 这个把要下载的链接丢进去进行加速。
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)