Cannot get WSO2 to work using membershipScheme=AWS - wso2-api-manager
I'm running WSO2 AM 1.10.0 on to Amazon EC2 nodes of the same region/zone. One of them is a manager node, the other worker node.
When running them using membershipScheme=WKA, everything works ok. When trying membershipScheme=AWS, both servers register correctly to the cloud but do not interact with each other. I verified the AWS parameters in axis2.xml are correct, and opened ports 5700-5800 to ALL.
My WKA configuration is this:
Manager node (WKA)
<parameter name="membershipScheme">wka</parameter>
<parameter name="localMemberPort">5701</parameter>
<parameter name="localMemberHost">ec2-M</parameter>
<groupManagement enable="true">
<applicationDomain name="wso2.apim.domain"
description="APIM group"
agent="org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent"
subDomain="worker"
port="5757"/>
</groupManagement>
<members>
<member>
<hostName>127.0.0.1</hostName>
<port>5701</port>
</member>
<member>
<hostName>ec2-GW</hostName>
<port>5702</port>
</member>
</members>
Worker node (WKA)
<parameter name="membershipScheme">wka</parameter>
<parameter name="localMemberPort">5702</parameter>
<parameter name="localMemberHost">ec2-GW</parameter>
<groupManagement enable="true">
<applicationDomain name="wso2.apim.domain"
description="APIM group"
agent="org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent"
subDomain="mgt"
port="5757"/>
</groupManagement>
<members>
<member>
<hostName>ec2-M</hostName>
<port>5701</port>
</member>
<member>
<hostName>127.0.0.1</hostName>
<port>5702</port>
</member>
</members>
In this mode everything works ok, and in manager log I see the gateway worker member joining the cluster:
Managing group application domain:wso2.apim.domain, sub-domain:mgt using agent class org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent
Cluster domain: wso2.am.domain
Using wka based membership management scheme
Added member: Host:127.0.0.1, Remote Host:null, Port: 5701, HTTP:-1, HTTPS:-1, Domain: null, Sub-domain:null, Active:true
Added member: Host:ec2-GW, Remote Host:null, Port: 5702, HTTP:-1, HTTPS:-1, Domain: null, Sub-domain:null, Active:true
Local member: [cf971938-ae01-42f7-84c1-563943ea1570] - Host:10.1.0.87, Remote Host:null, Port: 5701, HTTP:8281, HTTPS:8244, Domain: wso2.am.domain, Sub-domain:mgt, Active:true
Elected this member [cf971938-ae01-42f7-84c1-563943ea1570] as the Coordinator node
Added member: Host:10.1.0.87, Remote Host:null, Port: 5701, HTTP:8281, HTTPS:8244, Domain: wso2.am.domain, Sub-domain:mgt, Active:true
Application member Host:ec2-M, Remote Host:null, Port: 5757, HTTP:8281, HTTPS:8244, Domain: wso2.apim.domain, Sub-domain:mgt, Active:true joined application cluster
Member joined [a9268bd0-de59-47eb-bd90-69e6e3ef82c8]: ec2-GW/10.1.0.193:5702
Added member: Host:10.1.0.193, Remote Host:null, Port: 5702, HTTP:8280, HTTPS:8243, Domain: wso2.am.domain, Sub-domain:worker, Active:true
Now changing to AWS mode:
Manager and Worker node (AWS)
<parameter name="membershipScheme">aws</parameter>
<parameter name="accessKey">...</parameter>
<parameter name="secretKey">...</parameter>
<parameter name="securityGroup">...</parameter>
<parameter name="region">eu-west-1</parameter>
(left everything else untouched)
Managing group application domain:wso2.apim.domain, sub-domain:mgt using agent class org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent
Cluster domain: wso2.am.domain
Using aws based membership management scheme
Group management local member for domain [wso2.apim.domain],sub-domain [mgt] UUID: e8847f8c-b6c4-434d-9c3c-7eb8ceca59f2. Host:ec2-M, Remote Host:null, Port: 5757, HTTP:8281, HTTPS:8244, Domain: wso2.apim.domain, Sub-domain:mgt, Active:true
Local member: [2740f020-ca36-4e41-a94c-996d4c1a4fee] - Host:10.1.0.87, Remote Host:null, Port: 5701, HTTP:8281, HTTPS:8244, Domain: wso2.am.domain, Sub-domain:mgt, Active:true
Elected this member [2740f020-ca36-4e41-a94c-996d4c1a4fee] as the Coordinator node
Application member Host:ec2-M, Remote Host:null, Port: 5757, HTTP:8281, HTTPS:8244, Domain: wso2.apim.domain, Sub-domain:mgt, Active:true joined application cluster
As you can see from the log, there is no indication of the worker.
Furthermore, changes done in the manager are not consumed by the worker.
In the worker node:
Managing group application domain:wso2.apim.domain, sub-domain:worker using agent class org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent
Cluster domain: wso2.am.domain
Using aws based membership management scheme
Group management local member for domain [wso2.apim.domain],sub-domain [worker] UUID: d034e9b0-b101-4d78-af44-d3e4a28ba0fd. Host:ec2-GW, Remote Host:null, Port: 5757, HTTP:8280, HTTPS:8243, Domain: wso2.apim.domain, Sub-domain:worker, Active:true
Application member Host:ec2-GW, Remote Host:null, Port: 5757, HTTP:8280, HTTPS:8243, Domain: wso2.apim.domain, Sub-domain:worker, Active:true joined application cluster
Local member: [50961848-8d78-412f-b83f-01dc8c7ad3bf] - Host:10.1.0.193, Remote Host:null, Port: 5702, HTTP:8280, HTTPS:8243, Domain: wso2.am.domain, Sub-domain:worker, Active:true
Elected this member [50961848-8d78-412f-b83f-01dc8c7ad3bf] as the Coordinator node
I checked with telnet: ports 5757, 5701 and 5702 are accessible b/w the two nodes.
Any ideas why the two nodes are not communicating?
Follow up #1 based on comments
Added tag to both nodes
$ aws ec2 create-tags --resources ec2-M ec2-GW --tags Key=component,Value=gateway
Verifiy with describe-instances:
$ aws ec2 describe-instances
...
"Tags": [
{
"Value": "gateway",
"Key": "component"
}
]
...
Modified axis2.xml, for both ec2-M and ec2-GW:
<parameter name="localMemberPort">5701</parameter>
...
<parameter name="accessKey">...</parameter>
<parameter name="secretKey">...</parameter>
<parameter name="securityGroup">...</parameter>
<parameter name="region">eu-west-1</parameter>
<parameter name="tagKey">component</parameter>
<parameter name="tagValue">gateway</parameter>
Still no communication b/w the nodes
Follow up #2 after further investigation
Using Hazelcast REST API, I noticed that in WKA mode, each member is registered in Hazelcast of both nodes
On manager, running http://ec2-M:5701/hazelcast/rest/cluster:
Members [2] {
Member [ec2-M]:5701 this
Member [ec2-GW]:5702
}
On worker, running http://ec2-GW:5702/hazelcast/rest/cluster:
Members [2] {
Member [ec2-M]:5701
Member [ec2-GW]:5702 this
}
While in AWS mode, each node see only itself.
On manager, running http://ec2-M:5701/hazelcast/rest/cluster:
Members [1] {
Member [ec2-M]:5701 this
}
On worker, running http://ec2-GW:5701/hazelcast/rest/cluster:
Members [1] {
Member [ec2-GW]:5701 this
}
Related
How to configure artifactory CEPH S3 with Direct Upload Mechanism?
Artifactory: 7.38.8 It works fine with the Eventual Upload Mechanism. I try to change it to the Direct Upload Mechanism, but I cannot upload any file. My binarystore.xml configuration: <config version="1"> <chain> <provider id="cache-fs" type="cache-fs"> <provider id="s3" type="s3"/> </provider> </chain> <provider type="s3" id="s3"> <bucketName>xxx</bucketName> <endpoint>xxx.xx.xx.xxx</endpoint> <port>8060</port> <credential>xxxxx</credential> <identity>xxxxx</identity> <s3AwsVersion>AWS2</s3AwsVersion> <httpsOnly>false</httpsOnly> <property name="s3service.disable-dns-buckets" value="true"/> </provider> </config> Error messages: { "errors" : [ { "status" : 500, "message" : "Expecting stream to be instance of FileWrappingInputStream" } ] 2022-08-16T07:56:25.351Z [jfrt ] [ERROR] [31d9214b03152aae] [o.a.w.s.RepoFilter:315 ] [http-nio-8081-exec-8] - Upload request of example-repo-local:test/1/delivery/test.sh failed due to {} java.lang.RuntimeException: Expecting stream to be instance of FileWrappingInputStream
The chain defined in the storage configuration doesn't have an actual definition. Removing <provider id="cache-fs" type="cache-fs"> from the configuration file (binarystore.xml) and restarting Artifactory should help resolving the error. [OR] Amendment of cache settings for the definition you have made under should help.
Application Gateway: ResourceNotFound during AKS provisioning (bicep)
When we deploy our environment with e.g. AKS and Application Gateway through bicep, we get sometimes this error during AKS provisioning: { "status": "Failed", "error": { "code": "ResourceNotFound", "message": "The Resource 'Microsoft.Network/applicationGateways/xxx-agw' under resource group 'xxx-rg' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix" } } We create the Application Gateway in the same bicep file as the AKS, the Application Gateway is referenced here in the bicep code of the AKS: addonProfiles: { ingressApplicationGateway: { enabled: true config: { applicationGatewayId: applicationGateway.id effectiveApplicationGatewayId: applicationGateway.id } } When we run the bicep file again, everything works. So is this a timing issue or do I miss something? Thanks, Peter
Integrating Keycloak with Alfresco
I Use Alfresco in my spring boot Application. I wanted to use authentication subsystem(identity-service). i have given configurations to use in alfresco-global.properties. It is not connecting to Keycloak. No errors found in log. I could find in logs Authentication subsystem starts though. [ restartedMain] a.i.IdentityServiceDeploymentFactoryBean : Keycloak JWKS URL: http://localhost:8011/auth/realms/alfresco-dbp/protocol/openid-connect/certs 2019-10-24 16:41:34.956 INFO --- [ restartedMain] a.i.IdentityServiceDeploymentFactoryBean : Keycloak Realm: alfresco-dbp 2019-10-24 16:41:34.956 INFO --- [ restartedMain] a.i.IdentityServiceDeploymentFactoryBean : Keycloak Client ID: alfresco-client 2019-10-24 16:41:34.958 INFO --- [ restartedMain] o.a.r.m.s.ChildApplicationContextFactory : Startup of 'Authentication' subsystem, ID: [Authentication, managed, identity-service1] complete
Alfresco provides Identity Service for SSO. I have integrated Alfresco 6.2.2 with Identity Service 1.3. It is working fine. But still if you want to implement standalone keycloak independently, it will work with same configuration. I have tested with keycloak 9.0.3 and keycloak 11.0.0 (which is the underlying version of Identity Service 1.3) - both integrated with Alfresco, and working correctly. The configuration in alfresco files would remain the same : Below are the alfresco-global.properties settings. Keycloak is assumed to be running on port 8081: authentication.chain=identity-service-1:identity-service,alfrescoNtlm-1:alfrescoNtlm identity-service.auth-server-url=http://localhost:8081/auth identity-service.enable-basic-auth=true identity-service.realm=sharerealm identity-service.resource=alfresco csrf.filter.referer=http://localhost:8080 csrf.filter.origin=http://localhost:8080/* aims.enabled=true aims.realm=sharerealm aims.resource=alfresco aims.authServerUrl=http://localhost:8081/auth aims.publicClient=true Entry in share-config-custom.xml file: <!-- AIMS --> <config evaluator="string-compare" condition="AIMS"> <enabled>true</enabled> <realm>sharerealm</realm> <resource>alfresco</resource> <authServerUrl>http://localhost:8081/auth</authServerUrl> <sslRequired>none</sslRequired> <publicClient>true</publicClient> <autodetectBearerOnly>true</autodetectBearerOnly> <alwaysRefreshToken>true</alwaysRefreshToken> <principalAttribute>email</principalAttribute> <enableBasicAuth>true</enableBasicAuth> </config> If you are working with ADF or ADW (Alfresco Digital Workspace), then the following entry in app.config.json: "$schema": "../node_modules/#alfresco/adf-core/app.config.schema.json", "ecmHost": "http://localhost:8080", "aosHost": "http://localhost:8080/alfresco/aos", "baseShareUrl": "http://localhost:8080/adw", "providers": "ECM", "authType": "OAUTH", "oauth2": { "host": "http://localhost:8081/auth/realms/sharerealm", "clientId": "alfresco", "scope": "openid", "secret": "", "implicitFlow": true, "silentLogin": true, "publicUrls": [ "**/preview/s/*", "**/settings" ], "redirectSilentIframeUri": "http://localhost:8080/adw/assets/silent-refresh.html", "redirectUri": "/adw", "redirectUriLogout": "/adw/#/login" },
rabbitmq-bundle - symfony3 - how to configure a topic exchange and queues?
I can't find a great configuration for old sound rabbitmq bundle to deal with topics and wildcard. All I want is a unique exchange that post to multiple queue using wildcard. Let says for example, i have my exchange name user.update, and i want to post the same message on user.update.address, user.update.profile for a microservice strategy. do you know how to configure in the configuration file ? Thx for reading.
Just because you are looking for ... great configuration for old sound rabbitmq bundle ... visit http://www.inanzzz.com/ and search for "rabbitmq" which will give you what you wish for. To address your question, you can use config below (I haven't tested it but it should be fine). However, you still need to write whole functionality/classes/consumers/producers etc. so follow this example: RabbitMQ topic example with symfony including 1 Producer & 1 Exchange & 2 Queue & N Worker & 2 Consumer old_sound_rabbit_mq: connections: default: host: %rabbitmq.host% port: %rabbitmq.port% user: %rabbitmq.user% password: %rabbitmq.pswd% vhost: / lazy: true producers: user_update_producer: connection: default exchange_options: { name: user.update, type: topic } consumers: user_update_consumer: connection: default exchange_options: { name: user.update, type: topic } queue_options: name: user_update_queue routing_keys: - 'user.update.address' - 'user.update.profile' callback: your_application.consumer.user_update_consumer It's flow: user.update (P) -> user.update (E) -> [user.update.address & user.update.profile] -> user_update_queue (Q)
Spring Profile values getting mixed
I'm using Spring Boot 1.4.3.RELEASE and gradle 2.13 for developing an api. On local environment, 'local' profile is working perfectly, but I'm getting issue while deploying code in Linux/Unix server. Here is my application.yml with two profiles : dev and local --- spring: profiles: active: dev server: context-path: /api/v1 port: 8080 build: version: 1.0.0 cache: storage: path: '/home/user/content/storage/' --- spring: profiles: active: local server: context-path: /content-delivery/api/v1 port: 8081 build: version: 1.0.0 cache: storage: path: '/Yogen/api/code/cachedData' The command I'm using to deploy my war file is: jdk1.8.0_112/bin/java -jar _-Dspring.profiles.active=dev content-delivery.jar When I run my war it was working fine with only one profile, but once i added another profile, I'm getting values get mixed up causing error as below: 01:56:16.557 INFO ContentDeliveryApplication - The following profiles are active: dev ............ 02:00:48.182 INFO PropertyPlaceholderConfigurer - Loading properties file from file [/home/542596/content-api/resources/app-dev.properties] 02:00:51.939 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [class org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$290c5e2d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 02:00:55.736 INFO AnnotationActionEndpointMapping - Supporting [WS-Addressing August 2004, WS-Addressing 1.0] 02:01:25.559 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a08e9c2b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 02:01:56.522 INFO TomcatEmbeddedServletContainer - Tomcat initialized with port(s): 8081 (http) 02:01:57.669 INFO StandardService - Starting service Tomcat 02:01:57.877 INFO StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.6 02:02:11.228 INFO [/content-delivery/api/v1] - Initializing Spring embedded WebApplicationContext 02:02:11.228 INFO ContextLoader - Root WebApplicationContext: initialization completed in 353263 ms 02:02:19.412 INFO ServletRegistrationBean - Mapping servlet: 'dispatcherServlet' to [/] 02:02:19.517 INFO ServletRegistrationBean - Mapping servlet: 'messageDispatcherServlet' to [/services/*] 02:02:19.829 INFO FilterRegistrationBean - Mapping filter: 'metricsFilter' to: [/*] 02:02:19.829 INFO FilterRegistrationBean - Mapping filter: 'characterEncodingFilter' to: [/*] 02:02:19.829 INFO FilterRegistrationBean - Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 02:02:19.829 INFO FilterRegistrationBean - Mapping filter: 'httpPutFormContentFilter' to: [/*] 02:02:19.829 INFO FilterRegistrationBean - Mapping filter: 'requestContextFilter' to: [/*] 02:02:19.829 INFO FilterRegistrationBean - Mapping filter: 'webRequestLoggingFilter' to: [/*] 02:02:19.829 INFO FilterRegistrationBean - Mapping filter: 'applicationContextIdFilter' to: [/*] 02:02:46.283 ERROR EhcacheManager - Initialize failed. 02:02:46.284 WARN AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jsonObjectCacheManager': Invocation of init method failed; nested exception is org.ehcache.StateTransitionException: Directory couldn't be created: /Yogen/api/code/cachedData/cachedData 02:02:46.285 INFO StandardService - Stopping service Tomcat 02:02:47.528 INFO AutoConfigurationReportLoggingInitializer - Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 02:02:48.103 ERROR SpringApplication - Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jsonObjectCacheManager': Invocation of init method failed; nested exception is org.ehcache.StateTransitionException: Directory couldn't be created: /Yogen/api/code/cachedData/cachedData at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:137) ~[spring-beans-4.3.5.RELEASE.jar!/:4.3.5.RELEASE] The PropertyPlaceholderConfigurer has been configured as follows: #Configuration public class PropertyConfiguration { #Bean #Profile("dev") public static PropertyPlaceholderConfigurer developmentPropertyPlaceholderConfigurer() { PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer(); configurer.setLocation(new FileSystemResource("/home/542596/content-api/resources/app-dev.properties")); configurer.setIgnoreUnresolvablePlaceholders(true); return configurer; } } The console shows that properties file being read is correct also the profile is 'dev', but the port started and context-path and other values are being fetched from 'local' profile instead 'dev' profile. What I'm missing?? Thanks.
Your profiles are getting overridden. Better Boostrap your application using bootstrap.yml and have two application.yml as follows : application-dev.yml application-local.yml set profiles in bootstrap.yml to decide which property file to load: spring: profiles: active : dev # choose which application properties to load dev/local
Like #Barath stated, you cannot separate profile properties within a single application.yml file. Create a yml file for each profile, name it as follows application-{profile}.yml I would not use bootstrap.yml to specify which profile to load as you'll want to externalize this if possible, so passing it to the VM via -Dspring.profiles.active=dev would be preferable.
We also have another option similar to #Maxwell answer instead of passing the profile through VM property : you can have following files: application.yml application-dev.yml application-local.yml And define profile in application.yml : spring: profiles: active : dev This ensures loading of application.yml as well as application-dev.yml.