How to build a replicated ehcache through firewall and not to die trying

It's assumed that:

  • You already have a java application and you have an ehcache instance running in your program with 1 cache configured to replicate.
  • You want to connect 1 instance to another instance you have in a remote machine
  • The remote machine you are connecting to is located behind a firewall.
  • You have been given access to only 1 port to make an ssh connection to the remote (firewalled) machine.
Ehcache uses RMI to connect the remote instances. When the cache in host 1 tries to connect to cache in host 2, RMI opens a new server socket in host 1 to listen for incoming connections from the host 2.
The problem here is that these random ports are not accesible to remote hosts because the hosts are behind a firewall.

So to fix it, we need to configure ehcache to only use 2 ports. The "remoteObjectPort" does the magic. So we have this ehcache.xml configuration:
  • 1 server port for the ehcache server to listen to other ehcache servers.
  • 1 server port for the ehcache cache to listen to incoming connections (this cache is the actual map in memory that is being replicated).
And the related properties are these. Inject it with System.setProperties(ehcacheProperties) before loading the ehcache instance in your program.
Open the 4 tunnels to the remote machine:

  • 1 local port for the ehcache server to listen to incoming connections from remote cache server
  • 1 local port for the ehcache cache for incoming connections from the remote cache
  • 1 remote port for remote ehcache server to listen incoming connections from our local host
  • 1 remote port for remote ehcache cache to listen to incoming connections from our local host

Run java programs on both machines (local and remote) with the "java.rmi.server.hostname" so the RMI server reports to the other RMI (the remote one) that it's address is "127.0.0.1" rather than any other IP it may has; so the tunnels can work. If you have any comment or suggestion please contact me.

Comments

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete
  2. Christmas has come and New Year is coming. One of the things I will do next year is to follow your new posts. It's because they provide what I need. Your articles are informative and great. Stay healthy and write more posts. Thanks
    Short Ride || Kindergarten Dress Up games for kids for school || Moto X3M 2 free on abcya3 games

    ReplyDelete
  3. Nice blog,I understood the topic very clearly,And want to study more like this.
    Data Scientist Course

    ReplyDelete
  4. I am looking for and I love to post a comment that "The content of your post is awesome" Great work!

    data science course

    ReplyDelete
  5. It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!

    Data Science Course

    ReplyDelete
  6. I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one

    Data Science Training

    ReplyDelete
  7. I am looking for and I love to post a comment that "The content of your post is awesome" Great work!

    Simple Linear Regression

    Correlation vs Covariance

    ReplyDelete
  8. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple linear regression
    data science interview questions

    ReplyDelete
  9. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up.
    java training in chennai

    java training in omr

    aws training in chennai

    aws training in omr

    python training in chennai

    python training in omr

    selenium training in chennai

    selenium training in omr

    ReplyDelete
  10. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    course for analytics

    ReplyDelete
  11. It¦s truly a nice and helpful piece of info. I am satisfied that you simply shared this helpful information with us. Please keep us informed like this. Thanks for sharing.
    java training in chennai

    java training in velachery

    aws training in chennai

    aws training in velachery

    python training in chennai

    python training in velachery

    selenium training in chennai

    selenium training in velachery

    ReplyDelete
  12. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work.
    educational course

    ReplyDelete
  13. Very interesting blog. Many blogs I see these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome.You can also check my articles as well.

    360DigiTMG Data Science Course In Pune
    360DigiTMG Data Science Training In Pune

    Thank you..

    ReplyDelete
  14. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it. software training

    ReplyDelete
  15. Awesome article with valuable information it very helpful waiting for next blog update thank you.
    Data Analytics Course Online 360DigiTMG

    ReplyDelete
  16. Very interesting blog. Many blogs I see these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome.You can also check my articles as well.

    Data Science Course In Hyderabad
    Data Science Training In Hyderabad
    Best Data Science Course In Hyderabad

    Thank you..

    ReplyDelete
  17. Thank you, I appreciate that I getting a lot of good and reliable information from your post. Thanks for sharing such kind of nice and wonderful post.

    Php Web Development Company Bangalore | Ecommerce Website Developer India | Internet Marketing Company in Bangalore | Ecommerce Website Company In India

    ReplyDelete
  18. Excellent blog with very impressive writing and unique content, information shared was very valuable thank you.
    Data Science Course in Hyderabad

    ReplyDelete
  19. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.

    Simple Linear Regression

    Correlation vs covariance

    KNN Algorithm

    Logistic Regression explained

    ReplyDelete
  20. Crypto-currency as a modern form of the digital asset has received a worldwide acclaim for easy and faster financial transactions and its awareness among people have allowed them to take more interest in the field thus opening up new and advanced ways of making payments. Crypto.com Referral Code with the growing demand of this global phenomenon more,new traders and business owners are now willing to invest in this currency platform despite its fluctuating prices however it is quite difficult to choose the best one when the market is full. In the list of crypto-currencies bit-coins is one of the oldest and more popular Crypto.com Referral Code for the last few years. It is basically used for trading goods and services and has become the part of the so-called computerized block-chain system allowing anyone to use it thus increasing the craze among the public, Crypto.com Referral Code.

    Common people who are willing to purchase BTC can use an online wallet system for buying them safely in exchange of cash or credit cards and in a comfortable way from the thousands of BTC foundations around the world and keep them as assets for the future. Due to its popularity, many corporate investors are now accepting them as cross-border payments and the rise is unstoppable. With the advent of the internet and mobile devices,information gathering has become quite easy as a result the BTC financial transactions are accessible and its price is set in accordance with people’s choice and preferences thus leading to a profitable investment with Crypto.com Referral Code. Recent surveys have also proved that instability is good for BTC exchange as if there is instability and political unrest in the country due to which banks suffer then investing in BTC can surely be a better option. Again bit-coin transaction fees are pretty cheaper and a more convenient technology for making contracts thus attracting the crowd. The BTC can also be converted into different fiat currencies and is used for trading of securities, for land titles, document stamping, public rewards and vice versa.

    Another advanced block-chain project is Ethereumor the ETH which has served much more than just a digital form of crypto-currency Crypto.com Referral Code and its popularity in the last few decades have allowed billions of people to hold wallets for them. With the ease of the online world,the ETH have allowed the retailers and business organizations to accept them for trading purposes, therefore, can serve as the future of the financial system.

    ReplyDelete
  21. Terrific post thoroughly enjoyed reading the blog and more over found to be the tremendous one. In fact, educating the participants with it's amazing content. Hope you share the similar content consecutively.

    artificial intelligence certification in bhilai

    ReplyDelete
  22. Really wonderful blog completely enjoyed reading and learning to gain the vast knowledge. Eventually, this blog helps in developing certain skills which in turn helpful in implementing those skills. Thanking the blogger for delivering such a beautiful content and keep posting the contents in upcoming days.

    Data Science Course in Bhilai

    ReplyDelete
  23. Extraordinary blog went amazed with the content that they have developed in a very descriptive manner. This type of content surely ensures the participants to explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.

    Digital Marketing Course

    ReplyDelete
  24. Really nice and interesting blog information shared was valuable and enjoyed reading this one. Keep posting. Thanks for sharing.
    Data Science Training in Hyderabad

    ReplyDelete
  25. Nice Information Your first-class knowledge of this great job can become a suitable foundation for these people. I did some research on the subject and found that almost everyone will agree with your blog.
    Cyber Security Course in Bangalore

    ReplyDelete
  26. Writing in style and getting good compliments on the article is hard enough, to be honest, but you did it so calmly and with such a great feeling and got the job done. This item is owned with style and I give it a nice compliment. Better!
    Cyber Security Training in Bangalore

    ReplyDelete

  27. Great article with valuable information found very resourceful and enjoyed reading it waiting for next blog update thanks for sharing.
    Ethical Hacking Course in Bangalore

    ReplyDelete
  28. This is an excellent article. Thanks for sharing this information. I will be visiting your blog regularly for the latest articles. I will be visiting your blog regularly to see some of the latest posts. PMP Certification in Hyderabad

    ReplyDelete
  29. Great article with valuable information found very resourceful and enjoyed reading it waiting for next blog updated thanks for sharing.
    typeerror nonetype object is not subscriptable

    ReplyDelete
  30. They are produced by high level developers who will stand out for the creation of their polo dress. You will find Ron Lauren polo shirts in an exclusive range which includes private lessons for men and women.

    Business Analytics Course in Bangalore

    ReplyDelete
  31. I am impressed. I don't think I've met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here.
    B2B Marketplace
    Wholesalers
    Our Service Partners
    Refrigerator Repair Service
    Satta King
    Mumbai Call Girls

    ReplyDelete
  32. It's like you understand the topic well, but forgot to include your readers. Maybe you should think about it from several angles.

    Data Analytics Course in Bangalore

    ReplyDelete

  33. You actually make it look so easy with your performance but I find this matter to be actually something which I think I would never comprehend. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I’ll try to get the hang of it!
    data science courses

    ReplyDelete
  34. Purchase EMAIL LIST FROM RIGHT PROVIDER

    Email is an individual method of connecting to your possibilities. What's more, purchase email lists since it is a private message, trust and association are assembled as of now. The change rate is likewise higher contrasted with established press because of low operational and overhead expenses. What's more, email is simpler to screen and assess than printed materials. Through email showcasing, you can kick off your b2b lead age paying little mind to what kind of industry you are in. The initial step to purchase email list for promoting is picking the correct email list supplier. You have to purchase email rundown to get tightly to the important data of your future customers for your image. Along these lines, it will be simpler for you to look for organizations, discover contact people and leaders and approach your item and administrations.

    ReplyDelete
  35. Internet Download Manager 6.38 Construct 10 IDM Crack Patch with Serial Crucial down load is a type of shareware downloadmanager owned by an American company called Tonec Inc.. IDM Patch download free captures any type of download in a impressive time limit and then completes the download in a really short time and at a faster speed compared to any download manager at the moment. IDM company is based in nyc. IDM Download with Crack This program is readily available for Windows OS only for now.
    Currently IDM Serial Key Free has become a renowned application with more than 20 million customers all over the world. Internet downloadmanager Hack may shoot downloads from many browsers such as Internet Explorer, Microsoft Edge, Google Chrome, Opera, Firefox for virtually almost any kind of record of consumer choice. It's gained control over download; nevertheless, it shows its dialogue box to an individual.

    ReplyDelete
  36. holiday home for rent in Dubai is a DTCM licensed holiday home Operator managing vacation rental villas and apartments for short and mid term stay in Dubai.

    ReplyDelete
  37. Friendly Finance is South Africa's number 1 choice for finance - providing customers with all the information they need to make better financial decisions. friendlyfinance We provide hundreds of comparisons of common consumer finance products, such as personal loans, car loans, short-term loans and credit cards. Think of us as a helping hand in selecting consumer finance products.

    ReplyDelete
  38. Testimonial Review of Taskade, Taskade Ratings the all-in-one collaboration platform for remote teams. Unleash your team productivity with task lists, mindmaps, and video chat.

    ReplyDelete
  39. Truly mind blowing blog went amazed with the subject they have developed the content. These kind of posts really helpful to gain the knowledge of unknown things which surely triggers to motivate and learn the new innovative contents. Hope you deliver the similar successive contents forthcoming as well.

    Digital Marketing training in Raipur

    ReplyDelete
  40. Stupendous blog huge applause to the blogger and hoping you to come up with such an extraordinary content in future. Surely, this post will inspire many aspirants who are very keen in gaining the knowledge. Expecting many more contents with lot more curiosity further.

    Data Science training in Raipur

    ReplyDelete
  41. Tremendous blog quite easy to grasp the subject since the content is very simple to understand. Obviously, this helps the participants to engage themselves in to the subject without much difficulty. Hope you further educate the readers in the same manner and keep sharing the content as always you do.

    Digital Marketing training in Bhilai

    ReplyDelete
  42. Terrific post thoroughly enjoyed reading the blog and more over found to be the tremendous one. In fact, educating the participants with it's amazing content. Hope you share the similar content consecutively.

    Data Science certification in Bhilai

    ReplyDelete

  43. I have to search sites with relevant information ,This is a
    wonderful blog,These type of blog keeps the users interest in
    the website, i am impressed. thank you.
    Data Science Course in Bangalore

    ReplyDelete
  44. Recently, the keto diet has become extremely popular for its health benefits such as weight loss and preventing disease. A custom Keto plan for life! Visit here: keto diet foods

    ReplyDelete
  45. It is clear that Python is a vital language for web-based programmers. More can be learnt at a reputed Python training institute. data science course in india

    ReplyDelete
  46. I have to search sites with relevant information ,This is a
    wonderful blog,These type of blog keeps the users interest in
    the website, i am impressed. thank you.
    Data Science Training in Bangalore

    ReplyDelete
  47. Health Experts have proven that regular exercise coupled with a good diet allow you to live longer and healthier. In this busy day and age, not everyone has the time to go to the gym - resulting to a lot of overweight people that desperately need to exercise. A healthy alternative is for you to Buy Home Gym Equipments that you can store in your own home or even at your office. Here are some tips when buying home gym equipment.

    First, know your fitness goals and keep these goals in mind when you are buying home gym equipment. One of the biggest mistakes that people make is buying the biggest or trendiest fitness machine simply because they like how it looks. More often than not, these end up gathering dust in your storage rooms or garage because you never end up using them. It is important to take note of what particular type of physical activity you want or enjoy doing before you buy your exercise machine. If you are looking to loose a few pounds and you enjoy walking or hiking, a treadmill is the best option for you. If you are looking to tone your lower body while burning calories a stationary bike is your obvious choice. Similarly, Special Equipments for Core Strength Exercises, Strength Training Weight Vests, Core Strength & Abdominal Trainers, Home Cardio Training, Strength Training Power Cages, Strength Training Racks & More.

    Second, set aside a budget before Buying Home Gym Equipments. Quality exercise machines do not come cheap. They are constantly exposed to wear and tear when they are used properly. So, pick machines that are built to last and have passed quality certifications to get the most out of your money. If you are operating on a tight budget, think about investing in several weights, We can Provide you High Quality Home Gym Equipments at Very Low Prices for your Complete Uses: Core Strength Exercises, Strength Training Weight Vests, Core Strength & Abdominal Trainers, Home Cardio Training, Strength Training Power Cages, Strength Training Racks & More.

    Its the Right Time to Buy Home Gym Equipments for you at Very Low Prices.

    ReplyDelete
  48. Attend The Data Analyst Course From ExcelR. Practical Data Analyst Course Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analyst Course.
    Data Analyst Course

    ReplyDelete
  49. - Como organizar sua Semana com o Taskade - Segunda Feira, primeiro dia.
    - Como organizar sua semana com o Taskade - Terça - Vlog de Produtividade
    Como organizar sua semana com o Taskade - Quarta
    - Como organizar sua semana com o Taskade - Quinta - Vlog Produtividade.
    - Taskade - Sexta, Sábado e Domingo. Como foi e uma grande novidade

    ReplyDelete
  50. Very good message. I stumbled across your blog and wanted to say that I really enjoyed reading your articles. Anyway, I will subscribe to your feed and hope you post again soon.

    Business Analytics Course

    ReplyDelete
  51. I will very much appreciate the writer's choice for choosing this excellent article suitable for my topic. Here is a detailed description of the topic of the article that helped me the most.

    Data Analytics Course in Bangalore

    ReplyDelete
  52. Impresión online en gran formato, Photocalls personalizados imprimimos roll ups, photocalls, vinilos, lonas. Envío gratis

    ReplyDelete
  53. I have to search sites with relevant information ,This is a
    wonderful blog,These type of blog keeps the users interest in
    the website, i am impressed. thank you.
    Data Science Training in Bangalore

    ReplyDelete
  54. Truly incredible blog found to be very impressive due to which the learners who ever go through it will try to explore themselves with the content to develop the skills to an extreme level. Eventually, thanking the blogger to come up with such an phenomenal content. Hope you arrive with the similar content in future as well.

    Digital Marketing Course in Raipur

    ReplyDelete
  55. Fantastic blog extremely good well enjoyed with the incredible informative content which surely activates the learners to gain the enough knowledge. Which in turn makes the readers to explore themselves and involve deeply in to the subject. Wish you to dispatch the similar content successively in future as well.

    Data Science certification in Raipur

    ReplyDelete
  56. Wonderful blog found to be very impressive to come across such an awesome blog. I should really appreciate the blogger for the efforts they have put in to develop such an amazing content for all the curious readers who are very keen of being updated across every corner. Ultimately, this is an awesome experience for the readers. Anyways, thanks a lot and keep sharing the content in future too.

    Digital Marketing training in Bhilai

    ReplyDelete
  57. Highly appreciable regarding the uniqueness of the content. This perhaps makes the readers feels excited to get stick to the subject. Certainly, the learners would thank the blogger to come up with the innovative content which keeps the readers to be up to date to stand by the competition. Once again nice blog keep it up and keep sharing the content as always.

    Data Science training

    ReplyDelete

Post a Comment

Popular posts from this blog

Android 3D Model Viewer Open Source

Java 9 Process API

Google Drive FTP Adapter