基于滴滴云的蚂蚁蛋运维助手的安装和简单使用(一)

MYDan 运维助手 简介

MYDan ( 蚂蚁蛋助手 ) 是一个开源的运维工具,它采用自定义协议来管理分布在全球各个地区下隔离网络中的服务器。它具有如下特点:

  • 简单: 简单的安装方式,网络结构简单,可以方便的使用上专线资源
  • 安全: 密钥可以定时更新
  • 快速: 调用机器命令和传输文件非常高效
  • 全面: 支持 Linux 和 Window 环境

MYDan 在生成环境中已经被广泛使用,可以作为调度系统、作业平台、堡垒机等的核心组件。

MYDan 支持两种协议:SSH 协议和 MYDan 自定义协议。推荐使用 MYDan 自定义协议

一旦 MYDan 在所有的机器上运行起来之后,不管机器网络隔离的多么的复杂,批量操作机器、批量传输文件、获取远程 shell、灰度发布等等都会变的非常简单。

同时 MYDan 中带着大量的常用工具:

  • 快速登录服务器命令(Go)
  • 守护进程服务(Bootstrap)
  • 时间同步服务(Ntpsync)、
  • 脚本和数据压缩工具(Xtar)
  • 超时执行脚本攻击(Alarm)
  • 等等

基本环境要求

我们使用三个 滴滴云 DC2 服务器(需要多个服务器展示蚂蚁蛋的管理能力)来搭建一个最小化的 Etcd 集群,服务器的主机名与 IP 地址信息如下:

  1. mydan-1: 116.85.30.236
  2. mydan-2: 116.85.5.210
  3. mydan-3: 117.51.159.149

登陆 DC2,查看三个服务器的 IP 与 Hostname 详细信息如下:

  1. 第一个服务器的 IP 与主机名信息如下所示:
    
    [root
    
    @10
    
    -254-159-44 dc2-user]#  ip a | grep 'inet\b' | grep -v '127.0.0.1'
      inet 10.254.159.44/16 brd 10.254.255.255 scope global eth0
    [root
    
    @10
    
    -254-159-44 dc2-user]# hostname
    10-254-159-44
    
    
  2. 第二个服务器的 IP 与主机名信息如下所示:
    
    [root
    
    @10
    
    -254-6-127 dc2-user]#  ip a | grep 'inet\b' | grep -v '127.0.0.1'
      inet 10.254.6.127/16 brd 10.254.255.255 scope global eth0
    [root
    
    @10
    
    -254-6-127 dc2-user]# hostname
    10-254-6-127
    
    
  3. 第三个服务器的 IP 与主机名信息如下所示:
    
    [root
    
    @10
    
    -255-20-221 dc2-user]# ip a | grep 'inet\b' | grep -v '127.0.0.1'
      inet 10.255.20.221/24 brd 10.255.20.255 scope global eth0
    [root
    
    @10
    
    -255-20-221 dc2-user]# hostname
    10-255-20-221
    
    

安装蚂蚁蛋运维助手

蚂蚁蛋运维助手提供多种灵活的安装方式。

安装方式一

QuickStart - 安装最新版本到 /opt/mydan 下:


  [root@10-254-159-44 dc2-user]# curl -L http://update.mydan.org|bash
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100  1476  100  1476    0     0    483      0  0:00:03  0:00:03 --:--:--  3626
  OS:Linux ARCH:x86_64 ok
  perl version: 20171218153700
  .......
  ......
  ....
  /home/dc2-user
  mayi update OK
  mydan update OK

安装方式二

通过 cpan 命令安装:


[root@10-255-20-221 dc2-user]# dan=1 box=1 def=1 cpan install MYDan
CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.
Would you like to configure as much as possible automatically? [yes] yes
...
...
..
mayi update OK
mydan update OK

安装方式三

以下以安装 CentOS 的 /home/work/mydan 目录下为例:


 #安装编译perl
 [root@10-255-20-221 dc2-user]# wget http://www.cpan.org/src/5.0/perl-5.24.0.tar.gz
 [root@10-255-20-221 dc2-user]# tar -zxvf perl-5.24.0.tar.gz
 [root@10-255-20-221 dc2-user]# cd perl-5.24.0
 [root@10-255-20-221 dc2-user]# ./Configure -des -Dprefix=/home/work/mydan/perl -Dusethreads -Uinstalluserbinperl
 [root@10-255-20-221 dc2-user]# make
 [root@10-255-20-221 dc2-user]# make test
 [root@10-255-20-221 dc2-user]# make install
 #自己编译的perl需要安装比较多的木块,可以直接下载编译好的perl,解压到mydan目录下
 #安装mydan的dan,box,def
 [root@10-255-20-221 dc2-user]# cd /home/work/mydan
 [root@10-255-20-221 dc2-user]# git clone https://github.com/mydan/mayi.git
 [root@10-255-20-221 dc2-user]# cd mayi
 [root@10-255-20-221 dc2-user]# /home/work/mydan/perl/bin/perl Makefile.PL
 [root@10-255-20-221 dc2-user]# make
 [root@10-255-20-221 dc2-user]# make install dan=1 box=1 def=1

开始使用蚂蚁蛋运维助手

  1. 在 GitHub 中 fork https://github.com/MYDan/key 项目
  1. 把第一步的项目编辑好自己的公钥上传,私钥保留在自己电脑中

  2. 运行命令:

    
    [root
    
    @10
    
    -255-20-221 dc2-user]# export ORGANIZATION=lijinfeng2011  #其中MYDan为github账号
    [root
    
    @10
    
    -255-20-221 dc2-user]# curl -s https://raw.githubusercontent.com/MYDan/openapi/master/scripts/mydan/install.sh|bash
    
    

注:在没有以下 5 个参数的任何一个时,安装脚本不会把服务启动起来

  1. 组织名,即 GitHub上的组或者用户。在没配置 MYDAN_KEY_UPDATE 变量的情况下,用这个默认到 GitHub 账号下的 key 项目
    
    export ORGANIZATION=MYDan
    
    
  2. 更新公钥的地址:
    
    export MYDAN_KEY_UPDATE=https://raw.githubusercontent.com/MYDan/key/master/keyupdate
    
    
  3. 更新服务列表的地址:
    
    export MYDAN_PROC_UPDATE=https://raw.githubusercontent.com/MYDan/proc/master/procupdate
    
    
  4. 更新白名单地址:
    
    export MYDAN_WHITELIST_UPDATE=https://raw.githubusercontent.com/MYDan/openapi/master/config/whitelist
    
    
  5. 更新 MYDdan 脚本地址:
    
    export MYDAN_UPDATE=https://raw.githubusercontent.com/MYDan/openapi/master/scripts/mydan/update.sh
    
    

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31559758/viewspace-2287175/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31559758/viewspace-2287175/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值