千家信息网

windows怎么安装consul

发表于:2025-01-30 作者:千家信息网编辑
千家信息网最后更新 2025年01月30日,本篇内容主要讲解"windows怎么安装consul",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"windows怎么安装consul"吧!windows
千家信息网最后更新 2025年01月30日windows怎么安装consul

本篇内容主要讲解"windows怎么安装consul",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"windows怎么安装consul"吧!

windows 安装 consul

下载安装包

官网下载速度慢,不推荐

•官网下载地址:https://www.consul.io/downloads.html•其他下载: https://javapro.lanzous.com/id77xza

解压运行

打开 Windows PowerShell, 使用 .\consul.exe -h 查看命令帮助

PS C:\WINDOWS\system32> d:PS D:\> cd .\consul_1.7.3_windows_amd64\PS D:\consul_1.7.3_windows_amd64> .\consul.exe -hUsage: consul [--version] [--help]  []
Available commands are: acl Interact with Consul's ACLs agent Runs a Consul agent catalog Interact with the catalog config Interact with Consul's Centralized Configurations connect Interact with Consul Connect debug Records a debugging archive for operators event Fire a new event exec Executes a command on Consul nodes force-leave Forces a member of the cluster to enter the "left" state info Provides debugging information for operators. intention Interact with Connect service intentions join Tell Consul agent to join cluster keygen Generates a new encryption key keyring Manages gossip layer encryption keys kv Interact with the key-value store leave Gracefully leaves the Consul cluster and shuts down lock Execute a command holding a lock login Login to Consul using an auth method logout Destroy a Consul token created with login maint Controls node or service maintenance mode members Lists the members of a Consul cluster monitor Stream logs from a Consul agent operator Provides cluster-level tools for Consul operators reload Triggers the agent to reload configuration files rtt Estimates network round trip time between nodes services Interact with services snapshot Saves, restores and inspects snapshots of Consul server state tls Builtin helpers for creating CAs and certificates validate Validate config files/directories version Prints the Consul version watch Watch for changes in Consul

体验 consul

运行命令, 体验开发版

PS D:\consul_1.7.3_windows_amd64> .\consul.exe agent -dev

notes: 以开发版运行的时候 K/V 不保存哦~

看到控制台打印信息正常后,访问 http://localhost:8500/ui/dc1/services

持久化数据

新建 server 服务,指定 data-dir 保存数据

consul agent -server -bootstrap-expect 1 -data-dir "D://consul_1.7.3_windows_amd64/consul" -advertise 192.168.0.105 -ui -node=server1 -bind 192.168.0.105 -client 0.0.0.0 -rejoin -config-dir "D://consul_1.7.3_windows_amd64//config"

•-server: consul 服务端•-bootstrap-expect: 在一个 datacenter 中期望提供的 server 节点数目,当该值提供的时候,consul 一直等到达到指定 server 数目的时候才会引导整个集群•-data-dir: 持久化数据目录•-advertise: ip 地址,广播地址•-client: 可访问服务的 ip•-config-dir:配置文件地址

测试 consul 持久化

新增一个 Key/Value关闭,重新打开还在,ok

windows - consul 的安装到此结束了哦~

到此,相信大家对"windows怎么安装consul"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

0