Neo4j+DRBD+Keepalived高可用架构
本文转自http://www.ywnds.com/?p=12199Neo4j企业版支持集群及高可用架构,但是社区版本不支持,故才有结合第三方软件来做高可用架构。架构图如下:DRBD双主配置: http://www.ywnds.com/?p=6619Neo4j配置安装:http://www.ywnds.com/?p=12015Keepalived安装配置:http://www.ywnds.com/?
本文转自http://www.ywnds.com/?p=12199
Neo4j企业版支持集群及高可用架构,但是社区版本不支持,故才有结合第三方软件来做高可用架构。
架构图如下:
DRBD双主配置: http://www.ywnds.com/?p=6619
Neo4j配置安装:http://www.ywnds.com/?p=12015
Keepalived安装配置:http://www.ywnds.com/?p=7963
上面的几个组件的安装配置调试这里就不介绍了,看给出的链接文档即可。
这里主要说一下这种模式的keepalived配置文件:
MASTER配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
!
Configuration
File
for
keepalived
global_defs
{
notification_email
{
dkey
@
ywnds
.com
}
notification_email_from
root
@
localhost
smtp
_server
127.0.0.1
smtp_connect
_timeout
30
router_id
LVS
_DEVEL
}
vrrp_script
check_neo4j
{
script
"/data/scripts/check_neo4j.sh"
interval
1
fall
2
}
vrrp_instance
VI_1
{
state
MASTER
interface
eth0
virtual_router_id
52
priority
100
advert_int
1
authentication
{
auth_type
PASS
auth
_pass
1111
}
virtual_ipaddress
{
10.100.215.2
dev
eth0
label
eth0
:
vip
}
notify_stop
/
data
/
scripts
/
notify_stop
.sh
notify_master
/
data
/
scripts
/
notify_master
.sh
track_script
{
check
_neo4j
}
}
|
check_neo4j:检测neo4j是否有问题的脚本。
notify_stop:MASTER出现故障时执行的脚本。
notify_master:当角色变为MASTER时执行的脚本。
/data/scripts/check_neo4j.sh
1
2
3
4
5
6
|
#!/bin/sh
A
=
`
ps
aux
|
grep
-
w
"neo4j-community-3.2.6"
|
wc
-
l
`
if
[
$A
-
lt
2
]
;
then
echo
$A
>
/
tmp
/
check
.log
reboot
fi
|
/data/scripts/notify_stop.sh
1
2
3
4
5
6
7
|
#!/bin/bash
time
=
`
date
"+%F %H:%M:%S"
`
echo
-
e
"$time ------notify_stop------\n"
>>
/
data
/
logs
/
keepalived
/
notify_stop
.log
/
bin
/
umount
/
data
/
drbd
>>
/
data
/
logs
/
keepalived
/
notify_stop
.log
/
usr
/
sbin
/
drbdadm
secondary
neo4j
>>
/
data
/
logs
/
keepalived
/
notify_stop
.log
/
usr
/
bin
/
systemctl
stop
keepalived
>>
/
data
/
logs
/
keepalived
/
notify_stop
.log
echo
-
e
"\n"
>>
/
data
/
logs
/
keepalived
/
notify_stop
.log
|
/data/scripts/notify_master.sh
1
2
3
4
5
6
7
8
|
#!/bin/bash
time
=
`
date
"+%F %H:%M:%S"
`
echo
-
e
"$time ------notify_master------\n"
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
ssh
root
@
inte
-
neo4j
-
02
"reboot"
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
drbdadm
primary
neo4j
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
mount
/
dev
/
drbd1
/
data
/
drbd
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
/
data
/
drbd
/
neo4j
-
community
-
3.2.6
/
bin
/
neo4j
start
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
echo
-
e
"\n"
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
|
BACKUP配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
!
Configuration
File
for
keepalived
global_defs
{
notification_email
{
dkey
@
ywnds
.com
}
notification_email_from
root
@
localhost
smtp
_server
127.0.0.1
smtp_connect
_timeout
30
router_id
LVS
_DEVEL
}
vrrp_instance
VI_1
{
state
BACKUP
interface
eth0
virtual_router_id
52
priority
90
advert_int
1
authentication
{
auth_type
PASS
auth
_pass
1111
}
notify_master
/
data
/
scripts
/
notify_master
.sh
notify_backup
/
data
/
scripts
/
notify_backup
.sh
virtual_ipaddress
{
10.100.215.2
dev
eth0
label
eth0
:
vip
}
}
|
notify_master:当角色变为MASTER时执行的脚本。
notify_backup:当角色变为BACKUP时执行的脚本。
/data/scripts/notify_master.sh
1
2
3
4
5
6
7
8
|
#!/bin/bash
time
=
`
date
"+%F %H:%M:%S"
`
echo
-
e
"$time ------notify_master------\n"
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
ssh
root
@
inte
-
neo4j
-
01
"reboot"
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
drbdadm
primary
neo4j
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
mount
/
dev
/
drbd1
/
data
/
drbd
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
/
data
/
drbd
/
neo4j
-
community
-
3.2.6
/
bin
/
neo4j
start
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
echo
-
e
"\n"
>>
/
data
/
logs
/
keepalived
/
notify_master
.log
|
/data/scripts/notify_backup.sh
1
2
3
4
5
6
|
#!/bin/bash
time
=
`
date
"+%F %H:%M:%S"
`
echo
-
e
"$time ------notify_backup------\n"
>>
/
data
/
logs
/
keepalived
/
notify_backup
.log
/
bin
/
umount
/
data
/
drbd
>>
/
data
/
logs
/
keepalived
/
notify_backup
.log
/
usr
/
sbin
/
drbdadm
secondary
neo4j
>>
/
data
/
logs
/
keepalived
/
notify_backup
.log
echo
-
e
"\n"
>>
/
data
/
logs
/
keepalived
/
notify_backup
.log
|
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)