Răspuns Two workerRole in one instance

  • 3 mai 2012 09:47
     
     

    Hi,

    I have created azure project in eclipse Helios. 

    Now I want to use two workerRoles for two Tomcat. One is tomcat7.0.27 with one project and another one is tomcat5.0.28 with another project.

    When I run RunInEmulator.cmd I want to run this two tomcat.

    Basically I want to run two projects with two different tomcat version in One Instance.

    Please tell me how to do this.

    Thanks in Advance


    • Mutat de JOshiro 3 mai 2012 16:30 this seems to be an Azure question (From:Live Connect)
    •  

Toate mesajele

  • 3 mai 2012 23:33
     
     Răspuns

    Maybe you can try to spin two processes and each will start its own tomcat server with own Input Endpoint. This this is possible but I have never try it, so you have to research.

    Here is some how-to from Steve Marx http://blog.smarx.com/posts/using-other-web-servers-on-windows-azure

    Hope it helps Petr


    Microsoft Platform Developer Cloudikka blog

  • 9 mai 2012 06:00
     
     Răspuns Are cod

    Hi,

    Set two endpoint port say 81,82 in the worker role configuration

    Install Java, tomcat 7.0.27, tomcat5.0.28 via startup script

    Now in the Tomcat 7.0.27 make the port to 81 and  tomcat5.0.28 to 82

    @REM Setting up Azure Stroage Credentials
    set azurestoragename=happybuddha
    set azurestoragekey=***********************AZURE-STORAGE-KEY**************==
    set storagecontainername=xyz
    
    @REM Download Tomcat ZIP
    set filename=apache-tomcat-7.0.19-windows-x64.zip
    startup\packagedownloader.exe "%azurestoragename%" "%azurestoragekey%" "%storagecontainername%" "%filename%"
    
    @REM Download JRE Runtime ZIP
    set filename=jre7.zip
    startup\packagedownloader.exe "%azurestoragename%" "%azurestoragekey%" "%storagecontainername%" "%filename%"
    
    @REM Download Tomcat/Java Applicaiton ZIP
    set filename=myproject.zip
    startup\packagedownloader.exe "%azurestoragename%" "%azurestoragekey%" "%storagecontainername%" "%filename%"
    
    @REM unzip Tomcat
    cscript //B //Nologo startup\unzip.vbs apache-tomcat-7.0.19-windows-x64.zip "%ROLEROOT%\approot"
    
    @REM unzip JRE
    cscript //B //Nologo startup\unzip.vbs jre7.zip "%ROLEROOT%\approot\apache-tomcat-7.0.19"
    
    @REM unzip project files to tomcatServer\webapps folder
    md "%ROLEROOT%\approot\apache-tomcat-7.0.19\webapps"
    cscript //B //Nologo startup\unzip.vbs myproject.zip "%ROLEROOT%\approot\apache-tomcat-7.0.19\webapps"
    
    set JRE_HOME=%ROLEROOT%\approot\apache-tomcat-7.0.19\jre7
    set CATALINA_HOME=%ROLEROOT%\approot\apache-tomcat-7.0.19
    
    @REM Edit Server.xml
    @REM cd "%ROLEROOT%\approot\apache-tomcat-7.0.19\conf"
    @REM copy server.xml server.orig.xml
    @REM cscript //nologo startup\editserverxml.vbs server.xml 80
    
    @REM start the server
    cd "%ROLEROOT%\approot\apache-tomcat-7.0.19\bin"
    copy startup.bat startup.back
    set > %RoleRoot%\approot\env.txt
    startup.bat > %RoleRoot%\approot\tomcat.txt
    exit /b 0

    OnStart method listen to the ports 81,82

    public override bool OnStart()
            {
                // Set the maximum number of concurrent connections 
                ServicePointManager.DefaultConnectionLimit = 12;
    
                // For information on handling configuration changes
                // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
    
                TcpListener TomcatPortListener81 = new TcpListener(RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["TomcatWeb81"].IPEndpoint);
                TcpListener TomcatPortListener82 = new TcpListener(RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["TomcatWeb82"].IPEndpoint);
    
                TomcatPortListener81.Start();    
                TomcatPortListener82.Start();
    
                return base.OnStart();
            }

    example http://tomcatazure.codeplex.com/

    This should make things work.

  • 9 mai 2012 08:48
     
     

    Thank you so much for your reply.

    I will try this.

  • 9 mai 2012 08:48
     
     
    Thanks for your reply