首页 文章 精选 留言 我的

精选列表

搜索[博客搭建],共10000篇文章
优秀的个人博客,低调大师

centos6服务器搭建heartbeat

Heartbeat是High-Availability Linux Project (Linux下的高可用性项目)的产物,是一套提供防止业务主机因不可避免的意外性或计划性宕机问题的高可用性软件。Heartbeat可以从Linux-HA 项目Web 站点免费获得,它提供了所有HA (高可用性)系统所需要的基本功能,如启动和停止资源、监测群集中系统的可用性、在群集中的节点间转移共享IP 地址的所有者等。它通过串行线、以太网接口或同时使用两者来监测特定服务(或多个服务)的运行状况。 Heartbeat实现了HA 功能中的核心功能——心跳,将Heartbeat软件同时安装在两台服务器上,用于监视系统的状态,协调主从服务器的工作,维护系统的可用性。它能侦测服务器应用级系统软件、硬件发生的故障,及时地进行错误隔绝、恢复;通过系统监控、服务监控、IP自动迁移等技术实现在整个应用中无单点故障,简单、经济地确保重要的服务持续高可用性。 Heartbeat采用虚拟IP地址映射技术实现主从服务器的切换对客户端透明的功能。 实验环境 centos6.5_x64 master eth0 192.168.1.128 eth1 192.168.1.129 slave eth0 192.168.1.130 eth1 192.168.1.131 vip 192.168.1.200 实验软件 epel-release-6-8.noarch.rpm nginx.x86_64 heartbeat.x86_64 软件安装 rpm -ivh epel-release-6-8.noarch.rpm yum install -y libnet heartbeat* nginx* glib* vim /etc/hosts centos6 192.168.1.128 添加两行配置 master/slave相同操作 uname -n名字 centos6-1 192.168.1.130 less /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 centos6 192.168.1.128 centos6-1 192.168.1.130 ssh-keygen -t rsa master/slave相同操作 Generating public/private rsa key pair. Enter file in which to save the key(/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. scp /root/.ssh/id_rsa.pub root@192.168.1.128:/root/.ssh/authorized_keys scp /root/.ssh/id_rsa.pub root@192.168.1.130:/root/.ssh/authorized_keysssh信任 scp /root/aa.txt root@192.168.1.128:/root/ aa.txt 100% 0 0.0KB/s 00:00 scp /root/bb.txt root@192.168.1.130:/root/ bb.txt 100% 0 0.0KB/s 00:00 如果使用scp命令没有提示输入密码表示ssh信任成功 service nginx start chkconfig --level 35 nginx on cd /usr/share/doc/heartbeat-3.0.4/ master/slave相同操作 cp authkeys ha.cf haresources /etc/ha.d/ vim /etc/ha.d/authkeys #auth 1 #1 crc #2 sha1 HI! #3 md5 Hello! 找到 #auth 1 auth 3 #1 crc #2 sha1 HI! 3 md5 Hello!改为 第一种是CRC循环冗余校验,第二种是SHA1哈希算法,第三种是MD3哈希算法 chmod 600 /etc/ha.d/authkeys vim /etc/ha.d/haresources centos6 192.168.1.200/24/eth0:0 nginx master端配置 centos6-1 192.168.1.200/24/eth0:0 nginx slave端配置 设定虚拟IP和对应的接口,并且指定启动虚拟IP时启动NGINX服务 vim /etc/ha.d/ha.cf #debugfile /var/log/ha-debug 找到 debugfile /var/log/ha-debug 改为 touch /var/log/ha-debug #logfile /var/log/ha-log 找到 logfile /var/log/ha-log改为 日志文件位置 touch /var/log/ha-log logfacility local0 #keepalive 2 找到 检查时间间隔 keepalive 2改为 #deadtime 30 找到 设定死亡时间 deadtime 30 改为 #warntime 10 找到 设定告警时间 warntime 10 改为 #initdead 120 找到 设定初始化时间 initdead 20 改为 #udpport 694 找到 udpport 694 改为 udp端口号 #ucast eth0 192.168.1.2 找到 ucast eth1 192.168.1.131 改为 master端配置eth1为心跳线ip 192.168.1.131为slave端ip ucast eth1 192.168.1.129 改为 slave端配置 eth1为心跳线ip 192.168.1.129为master端ip auto_failback on 找到启动抢占模式(主在挂了以后重新起来后备会自动切换成备)auto_failback auto_failback on改为 node centos6 指定负载节点 node centos6-1 #ping 10.10.10.254 找到 ping 192.168.1.101 改为 #respawn hacluster /usr/lib/heartbeat/ipfail 找到 respawn hacluster /usr/lib64/heartbeat/ipfail 改为 chmod 600 /etc/ha.d/ha.cf service heartbeat start master/slave端相同操作 netstat -tuplna | grep heartbeat udp 0 0 0.0.0.0:56611 0.0.0.0:* 6831/heartbeat: wri udp 0 0 0.0.0.0:694 0.0.0.0:* 6831/heartbeat: wri ps -ef | grep heartbest root 8034 8015 0 00:27 pts/0 00:00:00 grep heartbest tail -f /var/log/ha-log ip-request-resp(default)[12892]: 2017/10/25_01:25:59 received ip-request-resp 192.168.1.200/24/eth0:0 OK yes ResourceManager(default)[12915]: 2017/10/25_01:26:00 info: Acquiring resource group: centos6 192.168.1.200/24/eth0:0 nginx /usr/lib/ocf/resource.d//heartbeat/IPaddr(IPaddr_192.168.1.200)[12943]: 2017/10/25_01:26:00 INFO: Resource is stopped ResourceManager(default)[12915]: 2017/10/25_01:26:00 info: Running /etc/ha.d/resource.d/IPaddr 192.168.1.200/24/eth0:0 start IPaddr(IPaddr_192.168.1.200)[13076]: 2017/10/25_01:26:00 INFO: Adding inet address 192.168.1.200/24 with broadcast address 192.168.1.255 to device eth0 (with label eth0:0) IPaddr(IPaddr_192.168.1.200)[13076]: 2017/10/25_01:26:00 INFO: Bringing device eth0 up IPaddr(IPaddr_192.168.1.200)[13076]: 2017/10/25_01:26:00 INFO: /usr/libexec/heartbeat/send_arp -i 200 -r 5 -p /var/run/resource-agents/send_arp-192.168.1.200 eth0 192.168.1.200 auto not_used not_used ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:45:17:73 brd ff:ff:ff:ff:ff:ff inet 192.168.1.129/24 brd 192.168.1.255 scope global eth1 inet6 fe80::20c:29ff:fe45:1773/64 scope link valid_lft forever preferred_lft forever 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:45:17:69 brd ff:ff:ff:ff:ff:ff inet 192.168.1.128/24 brd 192.168.1.255 scope global eth0 inet 192.168.1.200/24 brd 192.168.1.255 scope global secondary eth0:0 inet6 fe80::20c:29ff:fe45:1769/64 scope link valid_lft forever preferred_lft forever master端 ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:3d:5b:1b brd ff:ff:ff:ff:ff:ff inet 192.168.1.130/24 brd 192.168.1.255 scope global eth0 inet 192.168.1.200/24 brd 192.168.1.255 scope global secondary eth0:0 inet6 fe80::20c:29ff:fe3d:5b1b/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:3d:5b:25 brd ff:ff:ff:ff:ff:ff inet 192.168.1.131/24 brd 192.168.1.255 scope global eth1 inet6 fe80::20c:29ff:fe3d:5b25/64 scope link valid_lft forever preferred_lft forever slave端 看到eth0:0 说明配置成功 echo nginx_master > /usr/share/nginx/html/index.htmlmaster端 echo nginx_slave > /usr/share/nginx/html/index.html slave端 nginx -s reload

优秀的个人博客,低调大师

centos 7 minal 搭建ffmpeg+segmenter环境

在centos上安装软件 最方便的方式就是使用yum , 自动解决依赖关系, 没有那么麻烦! 需要手动添加yum源配置/etc/yum.repos.d/dag.repo: [dag] name=Dag RPM Repository forRed HatEnterprise Linux baseurl=http://apt.sw.be/RedHat/el$releasever/en/$basearch/dag gpgcheck=0 enabled=1 yum -y install ffmpeg 我这里使用源码编译安装, 需要耐心和细心点才能完成。 1.安装autoconf cd /App/src wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz tar xvf autoconf-2.69.tar.xz cd autoconf-2.69 ./configure make make install 2. 安装automake cd /App/src wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz tar xvf automake-1.15.tar.xz cd automake-1.15 ./configure make make install 3. 安装libtool(FAAC需要) cd /App/src wget http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz tar xvf libtool-2.4.6.tar.xz cd libtool-2.4.6 ./configure make make install 4. 安装yasm支持汇编优化(FFmpeg需要) cd /App/src wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz tar xvf yasm-1.3.0.tar.gz cd yasm-1.3.0 ./configure make make install 5. 添加动态链接库配置 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf 6. 安装MP3支持库LAME cd /App/src wgethttp://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz tar xvf lame-3.99.5.tar.gz cd lame-3.99.5 ./configure make make install 7. 安装AAC支持库FAAC make时报错:mpeg4ip.h:126: 错误:对‘char* strcasestr(const char*, const char*)’的新声明 需要修改common/mp4v2/mpeg4ip.h第123行至129行内容: #ifdef __cplusplus extern "C" { #endif char *strcasestr(const char *haystack, const char *needle); #ifdef __cplusplus } #endif 修改为: 1 2 3 4 5 6 7 #ifdef __cplusplus extern "C++" { #endif const char *strcasestr(const char *haystack, const char *needle); #ifdef __cplusplus } #endif cd /App/src wgethttp://jaist.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2 tar xvf faac-1.28.tar.bz2 cd faac-1.28 ./bootstrap ./configure --with-mp4v2 #按前文修改mpeg4ip.h内容 make make install 8. 安装AMR支持库opencore-amr cd /App/src wgethttp://jaist.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz tar xvf opencore-amr-0.1.3.tar.gz cd opencore-amr-0.1.3 ./configure make make install 9. 安装通用音乐音频编码格式支持库libvorbis # libvorbis需要libogg,先安装libogg库 cd /App/src wgethttp://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz tar xvf libogg-1.3.2.tar.xz cd libogg-1.3.2 ./configure make make install cd /App/src wgethttp://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz tar xvf libvorbis-1.3.5.tar.xz cd libvorbis-1.3.5 ./configure make make install 10. 安装x264库支持H.264视频转码 cd /App/src git clone git://git.videolan.org/x264.git cd x264 ./configure --enable-shared make make install 11. 安装Xvid库支持MPEG-4转码 cd /App/src wgethttp://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.bz2 tar xvf xvidcore-1.3.3.tar.bz2 cd xvidcore/build/generic ./configure make make install 12. 安装Theora视频压缩支持库 cd /App/src wgethttp://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.xz tar xvf libtheora-1.1.1.tar.xz cd libtheora-1.1.1 ./configure make make install 13. 安装NUT支持库 安装时64位Linux系统需要修改文件config.mak 在最后一个CFLAGS下一行增加: CFLAGS += -fPIC 否则安装FFmpeg make时报错: /usr/local/lib/libnut.a: could not read symbols: Bad value cd /App/src svn co svn://svn.mplayerhq.hu/nut/src/trunk libnut cd libnut ./configure make make install 14. 安装VP8/VP9编解码支持库 cd /App/src git clonehttp://git.chromium.org/webm/libvpx.git cd libvpx ./configure --enable-shared make make install 15. 安装FFmpeg最新版 cd /App/src wgethttp://ffmpeg.org/releases/ffmpeg-2.6.3.tar.bz2 tar xvf ffmpeg-2.6.3.tar.bz2 cd ffmpeg-2.6.3 ./configure --enable-version3 --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-libnut --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared make make install ldconfig 16. 安装segmenter git clonehttps://github.com/johnf/m3u8-segmenter cd m3u8-segmenter PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure make make install ln -s /usr/local/bin/m3u8-segmenter /usr/local/bin/segmenter 三、 编译安装注意事项 1. 可能发现编译FFmpeg或者其他支持库时,即使相关的所有依赖也编译安装上了,仍然make报错,主要的原因还是由于依赖的库版本冲突,编译时调用的是yum安装时自动下载安装的旧版本依赖库。此时的方法就是卸掉所有yum安装的旧版本FFmpeg和相关的依赖软件包或者重新找台新的纯净的系统重新开始安装,或者使用UbuntuServer最新版,一般Ubuntu Server最新版FFmpeg版本还是比较新的,直接执行命令 sudo apt-get install ffmpeg 会自动安装FFmpeg和相关依赖。 2. 有爱专研的或者受制于手头无多余机器的,只能老老实实得卸载旧软件,从头开始编译安装。如何去除旧版本yum安装的相关软件?我们可以借助yum deplist命令先找出所有相关依赖软件包,然后卸载除了公共软件包外的所有软件包。此方法也适用于安装其它软件时遇到类似同样的问题。 yum deplist ffmpeg | grep -v ffmpeg | grep provider | awk '{print $2}' | sort -u 从中挑出非公共软件包的软件包名卸载: rpm -e --nodeps a52dec dirac dirac-libs faac gsm lame libtheora opencore-amr SDL x264 rpm -e --nodeps $(rpm -qa | grep -i ffmpeg)

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册