nexus 的数据库备份是比较重要的,可以方便我们在故障的是时候进行应用恢复。
以下使用benthos 组件进行nexus 数据库备份事件的应用通知处理

环境准备

使用docker-compose 运行

  • docker-compose.yaml 文件
version: "3"
services:
nexus:
image: sonatype/nexus3
ports:
- "8081:8081"
volumes:
- ./nexus-data:/nexus-data
- ./backup/:/backup/
benthos:
image: jeffail/benthos
volumes:
- "./webhook.yaml:/benthos.yaml"
ports:
- "4195:4195"
smtp2http:
image: dalongrong/smtp2http
command: --listen=:25 --webhook=http://benthos:4195/ --strict=false
  • 启动
docker-compose up -d
  • 说明
    如果出现权限的问题,可以直接设置777 权限,简单(但是不是很合理)chmod 777 backup nexus-data

配置webhook 功能

使用全局webhook

  • 配置全局audit webhook

注意地址使用docker-compose 内置的服务发现功能,实际上就是benthos 服务的信息

  • 配置db exporter 任务
    如下

运行任务&&查看效果

  • 启动任务
    直接点击run运行配置的db exporter 任务
  • 效果
get email message: {"nodeId":"96F7F66A-20527F6B-BB8166EC-C9856291-FEAC65E0","initiator":"*TASK","audit":{"domain":"tasks","type":"started","context":"Admin - Export databases for backup","attributes":{"schedule":"Hourly{properties={schedule.startAt=2019-04-27T16:45:00.000Z, schedule.type=hourly}}","currentState":"CurrentStateImpl{state=RUNNING, nextRun=Sun Apr 28 07:45:00 UTC 2019, future=org.sonatype.nexus.quartz.internal.task.QuartzTaskFuture@74e6c97e}","lastRunState":"LastRunStateImpl{endState=OK, runStarted=Sun Apr 28 06:45:00 UTC 2019, runDuration=545}",".name":"dbbackup","lastRunState.runStarted":"1556433900003",".id":"89fe73e9-0e84-4fdc-8bd1-a29218ca1b50",".typeName":"Admin - Export databases for backup",".visible":"true",".typeId":"db.backup","lastRunState.endState":"OK",".updated":"2019-04-28T06:23:42.575Z",".recoverable":"false",".enabled":"true",".alertEmail":"dalongapp@qq.com",".message":"Admin - Export databases for backup","limitnode":"","lastRunState.runDuration":"545","location":"/backup",".created":"2019-04-28T06:23:42.575Z"}}}
benthos_1 | get email message: {"nodeId":"96F7F66A-20527F6B-BB8166EC-C9856291-FEAC65E0","initiator":"*TASK","audit":{"domain":"tasks","type":"finished","context":"Admin - Export databases for backup","attributes":{"schedule":"Hourly{properties={schedule.startAt=2019-04-27T16:45:00.000Z, schedule.type=hourly}}","currentState":"CurrentStateImpl{state=WAITING, nextRun=Sun Apr 28 07:45:00 UTC 2019, future=null}","lastRunState":"LastRunStateImpl{endState=OK, runStarted=Sun Apr 28 06:56:11 UTC 2019, runDuration=560}",".name":"dbbackup","lastRunState.runStarted":"1556434571288",".id":"89fe73e9-0e84-4fdc-8bd1-a29218ca1b50",".typeName":"Admin - Export databases for backup",".visible":"true",".typeId":"db.backup","lastRunState.endState":"OK",".updated":"2019-04-28T06:23:42.575Z",".recoverable":"false",".enabled":"true",".alertEmail":"dalongapp@qq.com",".message":"Admin - Export databases for backup","limitnode":"","lastRunState.runDuration":"560","location":"/backup",".created":"2019-04-28T06:23:42.575Z"}}}

说明

我们可以用这个功能,使用备份好的数据,以及通知,进行nexus 备份机器的启动还原,方便在故障出现的时候,快速恢复系统,但是有一个要就,就是仓库数据
也同时做了备份,或者使用了共享存储

参考资料

https://github.com/rongfengliang/nexus-webhook-for-dbexporter

 
 
 
 

nexus 数据库备份任务webhook 通知的更多相关文章

  1. nexus 数据库备份任务webhook 通知-另外一种方法

    使用benthos 做为webhook,是一种方法,功能很强大,但是有点复杂,所以换了一个更简单直接的webhook 工具 根据请求的数据,只处理关于db exporter 任务部分的消息,然后就是调 ...

  2. C#.NET SQL数据库备份与还原解决方案

    C#.NET SQL数据库备份与还原解决方案http://www.csframework.com/archive/1/arc-1-20110924-1841.htm 开发框架V2.2(快速开发版)系统 ...

  3. OCA读书笔记(15) - 执行数据库备份

    物理备份 -- 数据文件,控制文件,日志文件,参数文件 数据库备份 冷备 -- 归档和非归档均可以 什么时候必须用冷备?1. 数据库的模式为非归档的2. 用于现场保护 冷备的过程:1. 首先查看备份文 ...

  4. mysql 数据库备份ubuntu

    安装 1 sudo apt-get update 2. sudo apt-get install mysql-server 3 sudo  apt-get install mysql-client 4 ...

  5. 知识点:linux数据库备份

    服务端启用二进制日志 如果日志没有启开,必须启用binlog,要重启mysql,首先,关闭mysql,打开/etc/my.cnf,加入以下几行: [mysqld] log-bin 然后重新启动mysq ...

  6. linux数据库备份

    linux数据库备份 服务端启用二进制日志 如果日志没有启开,必须启用binlog,要重启mysql,首先,关闭mysql,打开/etc/my.cnf,加入以下几行: [mysqld] log-bin ...

  7. Oracle 数据库备份和恢复配置

    可能的失败及其解决方法 失败类型 我们坑你遇到的失败或错误分为两大类:物理和逻辑.物理错误一般是硬件错误或使用数据库的应用程序中的软件错误,而逻辑错误一般在终端用户级别(数据库用户和管理员). 按从轻 ...

  8. Oracle数据库备份恢复,巡检须要关注的对象设置以及相关恢复概述

    数据库备份恢复.巡检须要关注的对象设置: 1.数据库名称,以及DBID:  --dbid在v$database中     SYS@ORCL>select dbid,name from v$dat ...

  9. 阿里云数据库备份DBS商业化发布,数据库实时备份到OSS

    数据库备份DBS已于2018年5月17日正式商业化发布. 数据库备份(Database Backup,简称DBS)是为数据库提供连续数据保护.低成本的备份服务. 它可以为多种环境的数据提供强有力的保护 ...

随机推荐

  1. 字符串及其操作,字符的Unicode编码

    plainText=input('message:') for c in plainText: print(chr(ord(c)-3),end='') plainText=input('message ...

  2. 解决安装虚拟环境出现的问题(OSError: Command /home/python/.virtua...ngo3_web/bin/python3 - setuptools pkg_resources pip wheel failed with error code 2)

    python3的报错解决: OSError: Command /home/python/.virtua...ngo3_web/bin/python3 - setuptools pkg_resource ...

  3. 实现简单的ssh功能

    客户端代码: # -*- coding=utf-8 -*- __Author__ = "Dennis" import socket client = socket.socket() ...

  4. Problem 4: Largest palindrome product

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 ...

  5. SpringIOC容器装配Bean

    Spring 的core Container(Spring的核心容器)有四大部分:bean.context.core.expression 在进行Bean的配置时候,需要添加四个jar包 如下: 分别 ...

  6. PTA-栈

    1-1 若一个栈的输入序列为1,2,3,…,N,输出序列的第一个元素是i,则第j个输出元素是j−i−1. (2分) T         F   作者: DS课程组 单位: 浙江大学 1-2 若一个栈的 ...

  7. stylus导入时 报错These relative modules were not found

    These relative modules were not found: * ./star48_@2x.png in ./node_modules/_css-loader@0.28.7@css-l ...

  8. tomcat web漏洞整改--Apache Tomcat examples directory vulnerabilities

    在利用AWVS等弱扫工具对网站进行漏洞扫描时,经常会出现一些Tomcat漏洞问题,一般在弱扫报告中,都会给出简单的处理办法,但有时这些办法可能不太适合我们,或者在一些正式使用的环境中,不好操作,那么我 ...

  9. iOS Masonry控件等比例布局

    一.先解释相关API 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 /**  *  distribute with fixed spacing  *  *  ...

  10. 2018-4-12 数学建模MATLAB常用的一些函数

    一.求函数的极限问题 limit(fun,x,y,str) 意义:fun为所求极限的函数,x代表变量,y代表变量的极限值,str代表这个极限的类型,常用的参数是right,left. 如果是多个变量的 ...