Giter Club home page Giter Club logo

confd-manager's Introduction

部署教程

欢迎大家指正,我也会随时提交,并迭代。 感谢!

本系统的缺点: query写的比较混乱,函数和类命名不规范,但我懒得修改。后面的餐饮系统里面我会严格规范。

逻辑架构图

image

1、安装python2.7

安装方式略。可以选择centos7.x版本


安装mariadb mariadb-server mariadb-devel

安装python-devel ,python-etcd

安装Cython,

安装MySQL-python.x86_64 模块

2、部署etcd 这里是单机版本 (高可用方案也简单,可以参考我的其他github文档。)

yum install etcd -y 
配置信息 参考

[Member]
ETCD_NAME=confd-etcd
ETCD_DATA_DIR="/export/etcd/"
ETCD_LISTEN_PEER_URLS="http://0.0.0.0:2380"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379,http://0.0.0.0:4001"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://127.0.0.1:2380"
ETCD_INITIAL_CLUSTER="confd-etcd=http://127.0.0.1:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_ADVERTISE_CLIENT_URLS="http://127.0.0.1:2379,http://127.0.0.1:4001"
ETCD_DISCOVERY=""

3、部署confd

wget https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64
mkdir -p /opt/confd/bin
mv confd-0.16.0-linux-amd64 /opt/confd/bin/confd
chmod +x /opt/confd/bin/confd
export PATH="$PATH:/opt/confd/bin"
3.1 创建配置文件
nginx.toml
[template]
src = "nginx.conf.tmpl"
dest = "/opt/openresty/nginx/conf/vhost/test.conf"

keys =[
      "/test/nginx",
]

check_cmd = "/opt/openresty/nginx/sbin/nginx -t"
reload_cmd = "/opt/openresty/nginx/sbin/nginx -s reload"

nginx.conf.tmpl
{{range getvs "/test/nginx/*"}}
  {{.}}
{{end}}

注: 可以将agent 里面的数据库地址修改,并放到对应安装了confd和nginx的服务器,执行即可,会自动启动confd和生成模板。
启动 (可选项)
启动 confd 并从etcd里面读取信息
/opt/confd/bin/confd -watch -backend etcd -node=http://127.0.0.1:2379 -confdir /opt/confd/

4、部署代码

git clone https://github.com/573009114/confd-manager.git

5、修改setting.py配置

DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.mysql',
         'NAME': 'confd',
         'USER':'confduser',
         'PASSWORD':'confd123',
         'HOST':'127.0.0.1',
         'PORT':'3306',
     }
}

6、效果展示

image image

7、客户端安装

客户端安装:
yum install epel-release -y
yum install MySQL-python -y
运行confdAgent

confd-manager's People

Contributors

573009114 avatar adming-zz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

confd-manager's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.