How to use Lucene on my server - java

I want to use Apache Solr, or Elastic Search, or some form of Apache Lucene on my website. Do I have to have a completely separate server for it to run on?
My website runs on AWS on a Tomcat instance. I know that I can simply spin up an elastic search instance on AWS and use that. My goal is to do it without having to spend that money, and just use it on the server I already have. Is this possible?

The question is usually what problem you want to solve, and then deciding whether Elastic or Solr can be the solution to that problem.
But yes, you can run both elasticsearch and Solr on your existing server. You'd install either by following the installation guides in their manuals, and they'll both run as server daemons separate from your existing Tomcat installation.
Older versions of Solr was distributed as a .war file that you could run in Tomcat, but this is not (officially) supported any longer, and is not recommended (at it would require a bit of manual hacking).
You'd then write code in your existing webapp to query Solr or Elasticsearch for the information you want to retrieve.

Related

After installing a HAPI FHIR server, what database to use?

I'm new to HAPI FHIR, I created a google cloud compute engine VM, installed java and maven, cloned the hapi-fhir-jpaserver-starter and installed it with :
mvn install
Then runned it to test in my server with :
mvn jetty:run
Now I access it using : http://IP:8080/hapi-fhir-jpaserver
and I get this page :
Now all the resources are empty (patients etc..) , I need to know :
Is this a good server for production ?
What Database the server is actually using and how to access it ?
What type of Database I must set up and how ?
Thanks
EDIT :
I tried to install the hapi server using docker compose, I built the app with mvn clean install and ran the command docker-compose up -d --build but when the installation was finished I get the basic HAPI SERVER (the fresh one) not the version I edited and built.
Any ideas why ?
This s a question of opinion and isn't really an appropriate question to ask on this site. However, there certainly are many systems that do use HAPI in production.
It depends on which server. As per the documentation here, you can either use the 'plain' server and provide your own persistence layer or use the JPA server which uses JPA 2.0 with Derby as the default data store. Details about the database and its structure are defined in the aforementioned documentation
If you're not sure what to do and don't have an existing database you must use, it's probably simplest/wisest to stick with the JPA database as it's already properly configured and works pretty well.
This is an opinion question, so there is not a true right answer.
Having said that, I would stick with "known" setups.
https://smilecdr.com/docs/database_administration/database_design.html
Relationship between smilecdr and hapi
https://smilecdr.com/open-source.html
I am partial to Sql Server or Postgres.
I would not go with Oracle, unless my company is already heavily invested. See image later in this post.
https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_6014.htm
The command “Create Schema” ‘does not actually create a schema’. #makesPerfectSense But you automatically get a schema when you create a user.
Do what?? I am not a fan of Oracle. Some of it is historical, which is why I think MySql may be the ripped off bandaid.
=========================
2022 UPDATE.
SmileCDR has "discouraged" MySql.
https://smilecdr.com/docs/database_administration/setting_up_mysql.html
Note that as of 2021.11.R01, MySQL is discouraged for production use
due to performance limitations of the database. SmileCDR will continue
to support customers on this database, but if serious performance
issues arise, we will suggest migrating to a more performant database.

Solr 5+ on Azure

How can we host Solr 5+ as a Java app on Azure? I am following this article https://azure.microsoft.com/en-in/documentation/articles/web-sites-java-get-started/ to create a Java app in Azure.
However, Since Solr 5, Java Servlet (Tomcat) is inbuilt into the Solr install files, and it is an executable file!
Any idea, how to get it working on Windows Azure infrastructure that scales well when needed.
There's an MS OpenTech project that runs Solr on Azure inside a Worker Role. It's been created for Solr 4.x but you should be able to modify it to work with the latest version.
https://github.com/MSOpenTech/Windows-Azure-Solr
If you want something that's easier to set up, you can get a pre-configured Linux image that includes Solr from VM Depot. This can be deployed easily to Azure:
https://vmdepot.msopentech.com/List/Index?sort=&search=solr
As I know, you can create an template Ubuntu VM contains Solr to install Solr 4.0.0/4.8.1/4.9.0 on the Azure new portal, as the follow picture.
If you have to install Solr 5+, I suggest you can create the Azure VM and follow the solr offical getstart document to do it.
On Azure, there is a cloud search-as-a-service solution called Azure Search that allows you to easily add a robust search experience to the application using a simple REST API or .NET SDK without managing search infrastructure and becoming an expert in search.
I recommend you can try to use the Azure Search to realize your needs. Please move to https://azure.microsoft.com/en-us/documentation/articles/search-what-is-azure-search/ to know it.

Deploying a Java web application to Amazon

I am sure this question has been asked and answered before multiple times. But unfortunately, I am still not clear. Here is my issue.
I have a JSP, Servlet application which uses MySQL as the database. I have built the WAR file as well. Now I am in need of deploying this so it can be accessed online by anyone.
I looked into lot of areas including normal web hosting. However even though the services like DailyReazor are highly secured, they provide little for MySQL, around 250 MB for the package I selected.
Now I am looking into Amazon AWS. In AWS I am expecting to deploy my aplication and make it available online.The MySQL server should not contain limits like 250MB.
But I have never ever used this service AWS before. By reading various posts, I know that Elastic Beanstalk is the easiest way to go, but still not convinced about how to deploy it properly with database access and all. And in the other hand, will they give me a web address like "www.example.com" or will they simply provide an IP address?? I am also familiar with tomcat so I need to use it.
We will not upload files (images etc) at the moment, so I believe we can manage with around 20$ per month?
I really appreciate if someone can provide a clear guidance on deploying java web applications in Amazon, with the requirements I mentioned about MySQL, Global access and so on.
Amazon RDS for MySQL is a Database-as-a-service offerring from AWS. It is scaleable up to 3TB, and has scaleable IO as well. Of course it also depends on how much you prepared to pay. they manage the DB for you (backup etc). You get a URL to connect, credentials and you are set to go.
Amazon Elastic Beanstalk uses Tomcat. So you should be familiar with that. You upload your WAR file and specify what EC2 flavor you want (CPU/MEM etc). They launch a VM that is configured with Jva and Tomcat and deploy the WAR for you. You get an IP address.
Amazon Route 53 is the DNS service, where you can assign the IP address to your domain (assuming you have one)

Mapping an application in Hadoop

I have this project that involves both a client and a server. I developped both parts of the application in java and I want to test it in a hadoop cluster, since the server side is a simulation of a cloud, so by using hadoop I want to give my application a real sense of cloud environment. I started by creatin a multi-node Hadoop Cluster but I don"t know what should be the next step.
I would appreciate any enlightening.
The proper way to accomplish this would be to use a restful interface to send the commands.
For instance, on the computer that is the JobTracker, you could host a tomcat rest server. (Make sure that the hadoop dameons are running in the background). You could use a Spring/Hibernate based servlet in order to process the requests to the server. Finally, in the servlet, you could either include the hadoop-jars and call hadoop through the hadoop API, or you can call hadoop through the console (./hadoop runjar blah).
In order to upload files to the Server, you can use an sftp interface, or possibly directly upload files to the hdfs.
If you would like, I can share some code with you, because I have done a similar project.
Also, you can look into Apache Oozie. They host a restful job flow api for hadoop.

How to create the build using Eclipse 3.6

I am developing an web app using java/j2ee as middle ware and Mysql 5.1 as database. I have to deploy it on AWS-EC2 server.
My questions are:
How do I create the build
How do I deploy on ec2 server?
I am using Apache Tomcat-6. Should I use any other server like Apache2 as web-server?
Use WTP to create a Dynamic Web Module project.
Use AWS Toolkit for Eclipse
That's pretty terse, but you'll need so many more details that it's pointless to list them here. Read the docs, then come back with specific questions :)
Whether you need Apache2 in front of Tomcat depends on your requirements. If you need it you'll know it :) Things that you might want to punt off on Apache2:
SSL
Static content
URL rewriting
If you are just planning to do every thing manually. You should read this manual http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/
Basically,
You need to create an AMI instance of platform of your choice. (Win/Unix-based).
Configure it with the software that you need. In your case, Tomcat-6 and MySQL-5.1. Configure them. Set Schema etc.
Upload your WAR file to the instance and deploy to Tomcat-6.
Make sure Tomcat port (8080 or whatever you've configured) is open. You can configure this from AWS console's Security Group setting.
Use the instance's Public DNS to access your app. Public DNS can be found from AWS console.
There are many freely available, pre-configured AMI available. Since your setting is one of the most common one. I am sure you will get one and skip Step#2.

Categories