免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 4021 | 回复: 13
打印 上一主题 下一主题

请问,solaris有没有类似LVS+hearbeat 或LVS+keepalived这样的组合? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-03-04 11:05 |只看该作者 |倒序浏览
大家好,请问,solaris有没有类似LVS+hearbeat 或LVS+keepalived这样的组合?

现在我需要整web cluser+mysql cluster,Linux下有多种方案可以做:
1. apache转发请求。不知道apache能不能搞mysql cluster。应该不能的。

2. LVS+hearbeat 或LVS+keepalived。在linux下,这是非常好的组合。
目前我有一个问题就是,www.xxx.com部署在2台realserver上,
但是www.xxx.com/rsm 这个rsm.war不支持cluster部署,只能放到一台realserver上。如果第一台server down了,第二台server会启动rsm.war程序。

在linux下,我可以用hearbeat 或keepalived 检测 www.xxx.com/rsm的健康状态,而达到VIP总是指向活着的那个realserver。


我想知道,solaris下,有没有对应的组合。非常急!

请大家给出建议,在线等。

论坛徽章:
0
2 [报告]
发表于 2010-03-04 11:07 |只看该作者
我搜过chinaunix,以及其他网站,都没有这种玩法。
请大家赐教!如果解决,我会把我的解决过程总结出来,帖这里。

我这种特殊场合在电信环境中整合别人的网管系统时,很容易出现,如果有解决方案我想对大家都有帮助的。
再次谢谢大家。

论坛徽章:
0
3 [报告]
发表于 2010-03-04 11:22 |只看该作者
还有一个应用就是,某个java 程序server,在两台PC上运行,但是以master/slave的方式被访问。只有另外一个节点上的程序down掉【PC不见得会down】,那么我需要把Virtual IP绑定到这个slave机器上。在linux下,这都不是问题,solaris下,有对应的解决方案吗?


再比如,mysql cluster,有两个SQL节点对外提供服务,我想做一个VIP指向这两个节点,当某个节点down掉的时候,VIP就只指向这一个节点。这个问题,在soalris下,也没有解决方案!!!

solaris是不是真的没落了?

论坛徽章:
0
4 [报告]
发表于 2010-03-04 11:29 |只看该作者
我每30分钟来看一次。在线等。请大家帮忙!!!玩solaris的,就chinaunix有技术含量了。

论坛徽章:
0
5 [报告]
发表于 2010-03-04 13:04 |只看该作者
帮顶 围观

论坛徽章:
0
6 [报告]
发表于 2010-03-04 13:21 |只看该作者
帮顶 围观
喊佛 发表于 2010-03-04 13:04




围观也很感谢呀!!!

论坛徽章:
0
7 [报告]
发表于 2010-03-04 16:01 |只看该作者
采用虚拟IP绑定的办法。



import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.Iterator;
import java.util.Vector;


public class VIPTestMain {
        public static void main(String args[])throws Exception{               
                addVirtualIP("10.80.1.218");
                Thread.sleep(5000);
                delVirtualIP("10.80.1.218");
        }

        /**
         * TODO: Only linux and SunOS are supported.
         *
         * @param vip
         * @throws Exception
         */
        public static void addVirtualIP(String vip)throws Exception{
                String ethernetCardDeviceName = getEthernetCardDeviceName();
                System.out.println("ethernetCardDeviceName="+ethernetCardDeviceName);
                //
                if(ethernetCardDeviceName==null){
                        return;
                }
                               
                String os_name = System.getProperty("os.name").toLowerCase();
                if(os_name.indexOf("sun")>=0 || os_name.indexOf("solaris")>=0){
                        String command1 = "ifconfig "+ethernetCardDeviceName.trim()+":1 plumb";
                        String command2 = "ifconfig "+ethernetCardDeviceName.trim()+":1 "+vip+" up";
                        System.out.println("command1="+command1);
                        System.out.println("command2="+command2);
                        Runtime.getRuntime().exec(command1);
                        Runtime.getRuntime().exec(command2);                       
                }else if(os_name.indexOf("linux")>=0){
                        String command = "ip addr add "+vip+"/32 dev "+ethernetCardDeviceName;
                        System.out.println("command="+command);
                        Runtime.getRuntime().exec(command);                       
                }
        }
        /**
         * TODO: Only linux and SunOS are supported.
         * @param vip
         * @throws Exception
         */
        public static void delVirtualIP(String vip)throws Exception{
                String ethernetCardDeviceName = getEthernetCardDeviceName();
                System.out.println("ethernetCardDeviceName="+ethernetCardDeviceName);
                //
                if(ethernetCardDeviceName==null){
                        return;
                }
                               
                String os_name = System.getProperty("os.name").toLowerCase();
                if(os_name.indexOf("sun")>=0 || os_name.indexOf("solaris")>=0){
                        String command = "ifconfig "+ethernetCardDeviceName.trim()+":1 unplumb";
                        System.out.println("command="+command);
                        Runtime.getRuntime().exec(command);
                }else if(os_name.indexOf("linux")>=0){
                        String command = "ip addr del "+vip+"/32 dev "+ethernetCardDeviceName;
                        System.out.println("command="+command);
                        Runtime.getRuntime().exec(command);                               
                }                       
        }
       
        /**
         * TODO: Only linux and SunOS are supported.
         * @return
         * @throws Exception
         */
        public static String getEthernetCardDeviceName()throws Exception{
                String os_name = System.getProperty("os.name").toLowerCase();
                String deviceName = null;
                //
                if(os_name.indexOf("sun")>=0 || os_name.indexOf("solaris")>=0){
                        String command = "ifconfig -a";
                        System.out.println("command="+command);
                       
                        Vector v = executeCommand(command);
                        //                       
                        Iterator it = v.iterator();
                        while(it.hasNext()){
                                String item = it.next().toString();
                                if(item!=null){
                                        item = item.trim().toLowerCase();
                                        if(item.indexOf("loopback")<0 && item.indexOf("broadcast")>=0){
                                                System.out.println("item="+item);
                                                if(item.indexOf(":")>=0){
                                                        deviceName = item.substring(0,item.indexOf(":")).trim();
                                                }
                                                break;
                                        }
                                }                               
                        }                       
                }else if(os_name.indexOf("linux")>=0){
                        String command = "ip addr show";
                        Vector v = executeCommand(command);
                        //               
                        /*String firstLine = v.get(0).toString().trim();
                        deviceName = firstLine.substring(0,firstLine.indexOf(" "));*/                       
                        Iterator it = v.iterator();
                        while(it.hasNext()){
                                String item = it.next().toString();
                                if(item!=null){
                                        item = item.trim().toLowerCase();
                                        if(item.indexOf("loopback")<0 && item.indexOf("broadcast")>=0){
                                                System.out.println("item="+item);
                                                String ss[] = item.split(":");
                                               
                                                if(ss.length>=3){
                                                        deviceName = ss[1].trim();
                                                }
                                                break;
                                        }
                                }                               
                        }
                }
               
                return deviceName;
        }
       
        public static Vector executeCommand(String command)throws Exception{
                Process pro =Runtime.getRuntime().exec(command);
                Vector v = new Vector();
                //
                InputStream in = pro.getInputStream();
                InputStreamReader isr = new InputStreamReader(pro.getInputStream());
                LineNumberReader reader = new LineNumberReader (isr);
                String line = null;
                while( (line=reader.readLine())!=null){
                        if(line!=null){
                                System.out.println("line="+line);
                                v.add(line);
                        }                         
                }
                System.out.println("=======================================");
                reader.close();
                isr.close();
                in.close();
               
                return v;
        }       
}

论坛徽章:
0
8 [报告]
发表于 2010-03-05 12:51 |只看该作者
大家好,请问,solaris有没有类似LVS+hearbeat 或LVS+keepalived这样的组合?

现在我需要整web cluser+m ...
lovechina 发表于 2010-03-04 11:05



    sun-cluster应该可以,不过这个是收费的!免费的open-ha,好象也能实现,具体没研究过!

论坛徽章:
0
9 [报告]
发表于 2010-03-05 14:09 |只看该作者
X86的sun cluster不收费呀

论坛徽章:
0
10 [报告]
发表于 2010-03-05 15:30 |只看该作者
X86的sun cluster不收费呀
waily 发表于 2010-03-05 14:09



    真的么?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP