编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

爱上开源之etcd管理工具etcdv3-browser的安装

wxchong 2025-03-02 19:18:45 开源技术 20 ℃ 0 评论

前言

前面的有关etcd管理工具boot4go-etcd-browser的一系列文章都是重点介绍的通过etcdv3-browser进行etcd的管理功能,文章发表后,也受到了一些朋友的关注,都比较关注如何在自己的环境里搭建etcdv3-browser的环境, 在etcdv3-browser的项目说明文档里已经介绍了安装的方式,鉴于本人的英文水平不够,在项目的md文档里描述可能不清,所以特别今天在这里详细的介绍一下etcdv3-browser的安装方式。

ETCDV3-BROWSER的安装

etcdv3-browser是使用纯原生的html和JS语言开发的, 使用CubeUI作为前台的管理界面的主要框架,对etcd的实例的管理,完全通过etcd提供的V3的Restful API实现,故没有任何的后台环境的搭建,只需要搭建好自己的web服务器即可, etcdv3-browser的提供三种安装方式。

一、使用自己的WEB服务器

可以搭建自己的WEB服务器环境,比如nginx,tomcat都可以,或者和SpringBoot结合在一起。

首先下载etcv3-browser的源码,etcdv3-browser项目源码,

可以在github上搜索boot4go-etcdv3-browser, 项目地址
github.com/gohutool/boot4go-etcdv3-browser, 在github/gohutool里还有很多其他不错的项目,都可以看看

下载的目录里html就是etcdv3-browser的所有的html代码,

将此目录配置到Nginx即可

二、使用etcdv3-browser自己提供的WEB服务

etcdv3-browser项目考虑到stand-alone的场景需求,故在项目里实现了默认自带的WEB服务,不依赖于其他的WEB服务器, etcv3-browser的WEB服务是使用golang语言实现的,此种方式的安装,主要是针对golang语言开发者的场景的,

安装方法

下载源代码,将源代码导入到自己的golang开发环境或者golang环境下。 运行的主程序browser.go, 运行browser中的main方法,即可

如图。输出日志

[2022/06/16 11:07:53 CST 805] [INFO][gohutool.etcd4go.browser] (main.startHttpServer:183) Starting HTTP server on [::]:9996


WEB服务已经成功启动, etcdv3-browser自带WEB服务的启动端口 9996

也可以在golang的环境下,直接运行一下命令,打包成为可运行的程序包

Download sourcecode from github website, visit https://github.com/boot4go.

Install the golang runtime environment.

Come into the project directory

Run command as blow;

export GO111MODULE=on

export GOPROXY="https://goproxy.cn,direct"

go mod tidy

go mod download

go build -o server .

Run ./server command to start

三、DOCKER环境下的安装

docker环境下的安装,是最简单的安装方式, 从hub.docker上下载镜像,然后运行镜像,一行命令就可以搞定

运行命令

root@boot2docker:~# docker run --rm -p 9980:80 --name etcdv3-browser joinsunsoft/etcdv3-browser:1.0.0

运行结果:

root@boot2docker:~# docker run --rm -p 9980:80 --name etcdv3-browser joinsunsoft/etcdv3-browser:1.0.0

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration

/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/

/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh

10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf

10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf

/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh

/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh

/docker-entrypoint.sh: Configuration complete; ready for start up

2022/06/16 03:15:26 [notice] 1#1: using the "epoll" event method

2022/06/16 03:15:26 [notice] 1#1: nginx/1.21.5

2022/06/16 03:15:26 [notice] 1#1: built by gcc 10.3.1 20211027 (Alpine 10.3.1_git20211027)

2022/06/16 03:15:26 [notice] 1#1: OS: Linux 4.19.130-boot2docker

2022/06/16 03:15:26 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576

2022/06/16 03:15:26 [notice] 1#1: start worker processes

2022/06/16 03:15:26 [notice] 1#1: start worker process 32

2022/06/16 03:15:26 [notice] 1#1: start worker process 33

2022/06/16 03:15:26 [notice] 1#1: start worker process 34

访问端口 9980端口即可

映射域名

映射IP到 ***.joinsunsoft.com

window环境下设置hosts文件

192.168.56.101 etcdv3-browser.joinsunsoft.com

访问
http://etcdv3-browser.joinsunsoft.com:9980 就可以了


出现登录页面

登录的账号和密码

ginghan/123456

结语

通过以上的方式,就可以搭建到etcdv3-browser的环境, 注意这里最后的域名映射,这里是使用了CubeUI的框架, 需要使用授权码才行,通过域名绑定可以绕过这层检查。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表