Giter Club home page Giter Club logo

nerv's Introduction

Nerv Build Status

概述

神经元为物理机、私有云、公有云、容器及混合云环境提供PaaS服务,支持应用和服务的部署、运维。

user_flow

从源码构建

环境

构建

go get github.com/ChaosXu/nerv

cd $GOPATH/src/github.com/ChaosXu/nerv/cmd/webui/console
console$ npm install

cd $GOPATH/src/github.com/ChaosXu/nerv
nerv$ make build pkg-service pkg-webui pkg-all -e ENV=debug

nerv$ cd release
release$ ls
nerv            nerv.tar.gz

快速启动(单机版)

部署Nerv

在单台主机上部署Nerv

配置数据库

创建一个MySQL数据库 nerv 打开 release/nerv/nerv-cli/config/config.json,配置数据库连接

{
  "db": {
    "user": "root",
    "password": "root",
    "url": "/nerv?charset=utf8&parseTime=True&loc=Local"
  },
  "agent": {
    "port": "3334"
  }
}

安装与启动

部署并启动Nerv的所有服务

#Use the topolgoy to install system
cd release/nerv/nerv-cli/bin
bin$ ./nerv-cli nerv create -t ../../resources/templates/nerv/server_core.json -o nerv -n nerv_inputs.json
Create topology success. id=1

#Install softwares that used by the topology to the host
bin$ ./nerv-cli nerv install -i 1
Install topology success. id=1
#Setup configurations of nodes in the topology
bin$ ./nerv-cli nerv setup -i 1
Setup topology success. id=1
#Start system by the topology
bin$ ./nerv-cli nerv start -i 1
file: started, pid=30992
agent: started, pid=30988
server: started, pid=31038
webui: started, pid=33065
Start topology success. id=1

nerv_inputs.json为模板所需实参

{
  "name": "/nerv/server_core",
  "version": 1,
  "environment": "standalone",
  "inputs": [
    {
      "name": "os",
      "type": "string"
    },
    ...
  ],
  ...
}
{
  "os": "linux-x86_64" //darwin-x86_64 macOS
}

添加工作集群

添加集群并在其中安装Agent,以便后续在集群中部署应用或服务。Nerv不负责部署、启动或者管理其中的主机,它们由基础设施管理平台管理。

#Add credential for worker cluster
bin$ ./nerv-cli credential create -D worker_credential.json

#Add worker cluster
bin$ ./nerv-cli topo create -t ../../resources/templates/nerv/worker.json -o worker-cluster-1 -n worker_inputs.json

#Install agents in hosts of cluster
bin$ ./nerv-cli topo install -i 2
#Start agents in hosts of cluster
bin$ ./nerv-cli topo start -i 2

work_credential.json为工作节点访问凭据,当前仅支持SSH密码登录

{
  "Type": "ssh",      //类型
  "Name": "centos7",  //名称
  "User": "XXXX",
  "Password": "XXXX"
}

worker.json工作节点模板

{
  "name": "/nerv/worker",
  "version": 1,
  "environment": "ssh",
  "inputs": [
    {
      "name": "host_ip_list", //部署节点的主机列表
      "type": "string[]"
    },
    {
      "name": "host_credential",  //主机访问凭据
      "type": "string"
    },
    {
      "name": "os",             //主机系统类型
      "type": "string"
    },
    ...
  ],
  ...
}

worker_inputs.json

{
  "host_ip_list": [
    "XXX"
    "XXX"
    ...
  ],
  "host_credential": "ssh,{凭据名称}",
  "os":"linux-x86_64"
}

部署应用

在集群中部署一个示例应用

工作机制

concept

  • Application: 供人直接使用的程序。
  • Service: 供其它应用或服务使用的后台程序。
  • Template: 定义构成一个应用或服务所需的资源(服务器、安装包、配置文件等)及它们之间关系。
  • Topology: 使用模板创建的一个应用或服务的拓扑结构,通过Install、Setup、Start等操作部署、配置和启动应用或服务。
  • Resource Model: 定模板中的元素的类型,适配各种部署环境:物理机、公有云、私有云、容器以及混合云等。
  • Worker Cluster: 部署应用或服务的集群。
  • Agent: 运行与集群中的每台主机上的代理程序,负责执行本机上部署的应用或服务的实例的管理和监控工作。

部署与配置

TBD

nerv's People

Contributors

chaosxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nerv's Issues

MySQL HA

例如 缩容: 首先,给10台mysql安装缩容软件,配置好,跑起来。然后观察各mysql的复制进度,到一定程度(进度大致匹配,延迟小于某个阈值),锁住LVS(或者通知上层Route) 这样应用不会有流量写到各mysql, 然后等待各mysql的复制完毕,停止复制,通知LVS更改IP列表(原来10台可用的mysql地址改成缩容后的一台或两台)。缩容结束。

MySQL scale out & scale in

基于MySQL LB 拓扑 实现scale out|in

scale out :nerv-cli topo scaleout -i {topoId} -h {host_node_name},{new_ip_list}
scale in or dynamic out:nerv-cli topo scale -i {topoId} -h {host_node_name},{counts}

addFile failed

The tree component lost the focus after a file, so the activeNodes is empty.

const parent = this.tree.treeModel.activeNodes[0].parent.data;

回复早上面试

Q:如果我加入,最想做的是啥?
A:容器,想更加深入学习容器相关知识

MySQL Load Balance

拓扑如下:
+------------+ +------------+
| lvs master | | lvs backup |
+------------+ +------------+

+--------------+ +--------------+
| mysql proxy | | mysql proxy | ...... N台
+--------------+ +--------------+

+--------------+ +--------------+
| mysql | | mysql | ...... N台,每2台主备
+--------------+ +--------------+

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.