Hi Danushka,

If you are using WKA clustering, please check following steps for basic
clustering and find what is missing.

Pre-requisites - Extract WSO2 Identity Server to 2 locations (eg : NODE1,
NODE2)
Database - mysql

1. Create a mysql database. (eg: IdentityDB)
2. Refer to the database in master-datasources.xml in both Node1 and Node2.
url, username, password and driverClassName are the parameters you have to
modify.
   Here, username and password are the credentials to login to the mysql
server and access the created database.

   IS_NODE1/repository/conf/
datasources/master-datasources.xml
   IS_NODE2/repository/conf/datasources/master-datasources.xml

    <datasource>
            <name>WSO2_CARBON_DB</name>
            <description>The datasource used for registry and user
manager</description>
            <jndiConfig>
                <name>jdbc/WSO2CarbonDB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url>jdbc:mysql://localhost:3306/IdentityDB</url>
                    <username>root</username>
                    <password>mypassword</password>
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
        </datasource>


3. Since Node1 and Node2 are running in the same server, change the port
offset of Node2. Here I have set the offset to 1.

   IS_NODE2/repository/conf/carbon.xml

    <Offset>1</Offset>

4. Since both nodes have to point to the same LDAP, disable the embedded
ldap of Node2.
   IS_NODE2/repository/conf/embedded-ldap.xml

    <Property name="enable">false</Property>

   Point to the embedded LDAP in Node1 from Node2 in the particular user
store manager configuration. By default embedded LDAP is running in port
10389.
   IS_NODE2/repository/conf/user-mgt.xml

    <UserStoreManager
class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
            <Property name="ConnectionURL">
ldap://localhost:10389</Property>


5. Enable axis2 clustering in both Node1 and Node2.
   IS_NODE1/repository/conf/axis2/axis2.xml
   IS_NODE2/repository/conf/axis2/axis2.xml

       <clustering
class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent"
enable="true">

6. Set the membershipScheme to wka in both Node1 and Node2.
   IS_NODE1/repository/conf/axis2/axis2.xml
   IS_NODE2/repository/conf/axis2/axis2.xml

    <parameter name="membershipScheme">wka</parameter>

7. Use the same domain in all the nodes. You can keep the default value.
   IS_NODE1/repository/conf/axis2/axis2.xml
   IS_NODE2/repository/conf/axis2/axis2.xml

    <parameter name="domain">wso2.carbon.domain</parameter>

8. Change the localMemberPort of Node2.
   IS_NODE2/repository/conf/axis2/axis2.xml

    <parameter name="localMemberPort">4010</parameter>


9. Add member details of the cluster in both Nodes.
   IS_NODE1/repository/conf/axis2/axis2.xml
   IS_NODE2/repository/conf/axis2/axis2.xml


        <members>
            <member>
                <hostName>127.0.0.1</hostName>
                <port>4000</port>
            </member>
            <member>
                <hostName>127.0.0.1</hostName>
                <port>4010</port>
            </member>
        </members>

10. Since MySQL is used, copy the mysql jdbc driver to both nodes (eg:
mysql-connector-java-x.x.xx-bin.jar).
    IS_NODE1/repository/components/lib/
    IS_NODE2/repository/components/lib/

11. Start the Node1 with following command (from the IS_NODE1/bin
directory). It will create the necessary tables in the database.

    sh wso2server.sh -Dsetup

12. Start the Node2 with following command. Since the database tables are
aready created by Node1, no need to setup again.

    sh wso2server.sh


When the Node2 is started, Node1 terminal will display something like below.

[2014-10-29 23:18:14,849]  INFO
{org.wso2.carbon.core.clustering.hazelcast.wka.WKABasedMembershipScheme}
-  Member joined [6af069c3-8783-477b-b9cc-e6e69dac58c0]: /127.0.0.1:4010

Thanks,
TharinduE


On Thu, Mar 26, 2015 at 11:13 AM, Danushka Fernando <danush...@wso2.com>
wrote:

> Hi All
> I tried to follow clustering guide at [1]. There it guide us to use
> 127.0.0.1 as the local member host. But when I was creating a cluster in my
> local machine for some reason if I use 127.0.0.1 all the servers come up
> without any issue but clustering doesn't work. But if I use my network IP
> (10.100.0.101) it works. Any Idea whats going wrong here?
>
> [1] https://docs.wso2.com/display/CLUSTER420/Clustering+Identity+Server
>
> Thanks & Regards
> Danushka Fernando
> Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

Tharindu Edirisinghe
Software Engineer | WSO2 Inc
Identity Server Team
mobile : +94 775 181586
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to