How to get the FHIR server running with MySQL or MariaDB - HealthIntersections/fhirserver GitHub Wiki

== Requirements ==

  • Hardware: ** Windows computer for the FHIR server. ** Windows, Linux or Raspberry Pi for the Database – can be the same as the FHIR server, or a virtual machine… *** MS SQL Server, MariaDB or MySQL work fine. *** '''You need the server’s address (if not localhost) and the root password '''

  • Software: :* The FHIR Server – Get the most recent from here:[http://www.healthintersections.com.au/FhirServer/fhirserver.htm http://www.healthintersections.com.au/FhirServer/fhirserver.htm]

:* Microsoft Visual C++ Redistributable Package (x64) (any version above 2013 should work, here’s a recent one: [http://download.microsoft.com/download/3/b/f/3bf6e759-c555-4595-8973-86b7b4312927/vc_redist.x64.exe http://download.microsoft.com/download/3/b/f/3bf6e759-c555-4595-8973-86b7b4312927/vc_redist.x64.exe]

:* The database connector, depending on your Database: ::* IF you use MySQL, you need MySQL connector, version 5.3 (more recent versions were not fully tested so may or may not work) [https://dev.mysql.com/downloads/connector/odbc/5.3.html https://dev.mysql.com/downloads/connector/odbc/5.3.html]

Direct link: [https://dev.mysql.com/downloads/file/?id=472464 https://dev.mysql.com/downloads/file/?id=472464]

'''Note: There is an issue with MariaDB Connector and it won’t work on 64-bit machines.'''

::* IF you use MS SQL Server, you need MS SQL connector – Use Version 11 (more recent versions may not be well supported). [https://www.microsoft.com/en-us/download/details.aspx?id=36434 https://www.microsoft.com/en-us/download/details.aspx?id=36434]

== Directions==

=== Install and configure the database server === '''1. Install the database server.'''

Install MySQL (preferred) or MariaDB database engine on the Database computer (can be the same as the FHIR server computer or any other computer in your network). Several tutorials out there explain this in detail.

Windows: Simply follow the installer wizard.

Linux/Pi: apt-get install mariadb-server (for MariaDB)

or apt-get install apt-get install mysql-server

'''2. Change the configuration settings for your database server. '''

Below are some settings that work on a lower-end PC, your optimal settings may be different. The configuration file is, for example:

  • MariaDB on Linux: /etc/mysql/mariadb-conf.d/50-server.conf

  • MySQL on Windows: my.ini - in the “Program files\MySQL\data” folder.

'''Do all the changes below a), b) and c) to the configuration file:'''

a) comment out the any line that says bind-address = 127.0.0.1 (just add a # at the beginning of that line)

b) Add the following lines to the file: query_cache_size = 64M query_cache_min_res_unit =2 tmp_table_size = 128M max_heap_table_size = 128M skip-name-resolve innodb_file_per_table = 1 innodb_flush_log_at_trx_commit = 2 lower_case_table_names = 1 innodb_flush_method=O_DIRECT max_binlog_size = 100M expire_logs_days=2 innodb_ft_min_token_size=1 ft_min_word_len=2 autocommit=1 connect_timeout=120 long_query_time=60 character-set-server = utf8 collation-server = utf8_general_ci max_allowed_packet = 32M optimizer_switch=orderby_uses_equalities=off

(the last line is a workaround for a MariaDB 10.2 bug that prevented Text search. In case you have problems starting up with MySQL or other versions of MariaDB, remove that line)

c) Set the pool size to 50-70% of your RAM: #* E.g. Windows PC with 2 GB Ram: innodb_buffer_pool_size = 1280M

:* on the Raspberry Pi: innodb_buffer_pool_size = 500M

'''3. Restart the database server'''

  • Windows: Go to Services, find the mysql service and restart
  • Linux / pi: sudo service mysqld restart

'''4. Add a user and a database'''

Go to mysql\bin directory, run

Mysql -u root -p

(it will ask you to enter the root password)

In the MySQL prompt, enter the following commands:

CREATE DATABASE fhirDB CHARACTER SET utf8 COLLATE utf8_unicode_ci;

And then the user and password. For example, user '''dbadmin''', password '''LetMeIn'''

CREATE USER 'dbadmin'@'%' IDENTIFIED BY 'LetMeIn'; GRANT ALL PRIVILEGES ON . TO 'dbadmin'@'%' IDENTIFIED BY 'LetMeIn' WITH GRANT OPTION;

Remember this login and password for the server.

=== Install the FHIR server ===

'''Basic settings, Service configuration'''

First, choose the FHIR version you want to use and then the program folder.

In the Additional tasks, best leave the options as they are.

Service Details – you would normally leave this blank

'''Web server configuration'''

Then web server configuration:

  • use this server’s domain name (how it’s going to be reachable from other systems, e.g. '''fhirserver.local'''
  • http port: don’t use port 80 nor 8080, since lots of applications may use that port. For example '''960'''
  • path: use any path tht is convenient. For example, '''/r3'''

'''Database server configuration'''

  • Select the ODBC driver from the top list. If there is no driver in the list, or if none of them is either MySQL or SQL Server, just go back.
  • Server: enter here the address of the server (dns or ip address). If it is the same PC as the FHIR server, this is the same as the web server address before.
  • Database: type here the database you created, e.g. fhirDB.
  • Username and password: type here the credentials you entered before.

'''Choose security configuration, and install.'''

'''Depending on your machine, this will take between 20 minutes and a lot longer. Go outside, or catch up with emails. If this is on a Raspberry Pi over Wi-Fi, go outside or catch up with sleep - it takes several hours.'''

'''Once the installation is done, give it a few minutes so that the service can start, and in your computer or anywhere in the network, type the server’s address and port. Using our example values:'''

[http://fhirserver.local:960/r3 http://fhirserver.local:960/r3]

You should see the fhir server page.

⚠️ **GitHub.com Fallback** ⚠️