uPortal4.3集群部署

参考文献
  • JGroups 入门实践【链接
  • Ehcache分布式缓存实现【链接
portal.properties修改
################################################################################
##                                                                            ##
##                      jGroups TCP Cluster Configuration                     ##
##                                                                            ##
################################################################################

##
## The default jGroups configuration shipped with uPortal uses TCP Unicast. If
## a different jGroups configuration is needed change the contents of
## uportal-war/src/main/resources/properties/jgroups.xml
##
## The jGroups manaul can be found here:
##  http://www.jgroups.org/manual-3.x/html/index.html
##
## Alternative configurations can be found here:
##  https://github.com/belaban/JGroups/tree/1df66514dcfd7dd3ea494709184a6430f71e3820/conf
##
## For additional information, see
##  http://jasig.275507.n4.nabble.com/Re-uportal-dev-EhCache-and-jgroups-question-td4661918.html

##
## The port to use for the FD_SOCK protocol
## http://www.jgroups.org/manual-3.x/html/protlist.html#FD_SOCK
##
## Note that the default configuration is to use a 50 port range starting at
## the start_port. So if the specified start_port is already in use the port
## number is incremented and the next port is tried.
##
uPortal.cacheManager.jgroups.fd_sock.start_port=7800

##
## The port for the TCP transport to listen on
## http://www.jgroups.org/manual-3.x/html/protlist.html#Transport
##
## Note that the default configuration is to use a 50 port range starting at
## the bind_port. So if the specified bind_port is already in use the port
## number is incremented and the next port is tried.
##
uPortal.cacheManager.jgroups.tcp.bind_port=7800

##
## The length of the random token used for the AUTH protocol of the default jGroups
## configuration. Should be a value between 100 and 1000
##
org.jasig.portal.jgroups.auth.token_length=1000
jgroups.xml调整
<!--
    TCP based stack, with flow control and message bundling. This is usually used when IP
    multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast).
    Note that TCP.bind_addr and TCPPING.initial_hosts should be set, possibly via system properties, e.g.
    -Djgroups.bind_addr=192.168.5.2 and -Djgroups.tcpping.initial_hosts=192.168.5.2[7800]
    author: Bela Ban
-->
<config xmlns="urn:org:jgroups"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.1.xsd">
    <TCP bind_addr="192.168.0.1"
		 bind_port="${uPortal.cacheManager.jgroups.tcp.bind_port}"
         loopback="false"
         recv_buf_size="${tcp.recv_buf_size:20M}"
         send_buf_size="${tcp.send_buf_size:640K}"
         max_bundle_size="64K"
         max_bundle_timeout="30"
		 enable_bundling="true"
         use_send_queues="true"
         sock_conn_timeout="300"

         timer_type="new"
         timer.min_threads="4"
         timer.max_threads="10"
         timer.keep_alive_time="3000"
         timer.queue_max_size="500"
         
         thread_pool.enabled="true"
         thread_pool.min_threads="1"
         thread_pool.max_threads="10"
         thread_pool.keep_alive_time="5000"
         thread_pool.queue_enabled="false"
         thread_pool.queue_max_size="100"
         thread_pool.rejection_policy="discard"

         oob_thread_pool.enabled="true"
         oob_thread_pool.min_threads="1"
         oob_thread_pool.max_threads="8"
         oob_thread_pool.keep_alive_time="5000"
         oob_thread_pool.queue_enabled="false"
         oob_thread_pool.queue_max_size="100"
         oob_thread_pool.rejection_policy="discard"/>

	<TCPPING timeout="3000"
             initial_hosts="${jgroups.tcpping.initial_hosts:192.168.0.1[7800],192.168.0.2[7801]}"
             port_range="1"
             num_initial_members="10"/>

    <MERGE2  min_interval="10000"
             max_interval="30000"/>
    <FD_SOCK start_port="${uPortal.cacheManager.jgroups.fd_sock.start_port}"/>
    <FD timeout="3000" max_tries="3" />
    <VERIFY_SUSPECT timeout="1500"  />
    <BARRIER />
    <ENCRYPT encrypt_entire_message="false" sym_init="128" sym_algorithm="AES/ECB/PKCS5Padding" asym_init="512" asym_algorithm="RSA"/>
    <pbcast.NAKACK2 use_mcast_xmit="false"
                   discard_delivered_msgs="true"/>
    <UNICAST />
    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
                   max_bytes="4M"/>
    <AUTH auth_class="org.jasig.portal.jgroups.auth.HashedDaoAuthToken"/>
    <pbcast.GMS print_local_addr="true" join_timeout="3"

                view_bundling="true"/>
    <UFC max_credits="2M"
         min_threshold="0.4"/>
    <MFC max_credits="2M"
         min_threshold="0.4"/>
    <FRAG2 frag_size="60K"  />
    <!--RSVP resend_interval="2000" timeout="10000"/-->
    <pbcast.STATE_TRANSFER/>
</config>
ehcache.xml修改
    <!--在自定义缓存时,如需同步缓存时需添加如下配置导cache配置中-->
	<cacheEventListenerFactory
            class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
            properties="replicateAsynchronously=true,
                replicatePuts=false,
                replicateUpdates=true, replicateUpdatesViaCopy=false,
                replicateRemovals=true "/>
RMI版本集群配置
<!-- 集群地址通信组(多个节点必须用同一个组) -->
<cacheManagerPeerProviderFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
        properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446, timeToLive=32"
        propertySeparator="," />
<!-- 设置通信端口 -->
<cacheManagerPeerListenerFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
        properties="port=41001" />
<!-- 使用方法 -->
<cache name="gds.portal.layout.stylesheet.UserStylesheelServiceBean"
           eternal="false" maxElementsInMemory="2000" overflowToDisk="false" diskPersistent="false"
           timeToIdleSeconds="0" timeToLiveSeconds="300" memoryStoreEvictionPolicy="LRU" statistics="true">
        <cacheEventListenerFactory
                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                properties="replicateAsynchronously=true,
                replicatePuts=false,
                replicateUpdates=true, replicateUpdatesViaCopy=false,
                replicateRemovals=true "/>
    </cache>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值