Database Settings

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Database Parameters)
(MSSQL)
(36 intermediate revisions by 13 users not shown)
Line 1: Line 1:
 
{{Quicklinks}}
 
{{Quicklinks}}
__NOTOC__
 
  
 
If you want to quick know the walkthrough for database setup, see [[#Quick Setup]].
 
If you want to quick know the walkthrough for database setup, see [[#Quick Setup]].
 +
 +
'''TODO: This page needs to be improved for setting up database usage in Robust, though the config parameters are identical to the StandaloneCommon.ini/GridCommon.ini files.
  
 
= Structure =
 
= Structure =
  
On OpenSim 0.7.1 or later, you need to set '''StorageProvider''' and '''ConnectionString''' for each data services (e.g. region database, asset service, inventory service) in the config files in config-include/. Usually you'll need to edit '''StandaloneCommon.ini''' for standalone or '''GridCommon.ini''' for grid mode.
+
On OpenSimulator 0.7.1 and later, you need to set '''StorageProvider''' and '''ConnectionString''' so that OpenSimulator can connect to a database. Usually you'll need to edit '''StandaloneCommon.ini''' for standalone or '''GridCommon.ini''' for grid mode.
  
In those files, you'll find [DatabaseService] section, which parameters control the parameters of data services in general. Only you have to care about are these two lines below:
+
In those files, you'll find the [DatabaseService] section.  This is where the database is configured.  There are number of entries - the only ones that should be uncommented (by removing the beginning semi-colon) are those which apply to the database that you want.  All the others must be commented out (by adding a semi-colon to the front of the line).  
 +
 
 +
==Examples==
 +
 
 +
===MySQL===
 +
 
 +
For MySQL you will uncomment the required lines and configure as appropriate.  For instance, the lines
  
 
<pre>
 
<pre>
 
StorageProvider = "OpenSim.Data.MySQL.dll"
 
StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;"
+
ConnectionString = "Data Source=localhost;Database=opensimdb;User ID=opensim;Password=h0tgrits;Old Guids=true;"
 
</pre>
 
</pre>
  
In this case, it will connect to the database which can access by the connection string "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" using the provider module named "OpenSim.Data.MySQL.dll".
+
In this case, it will connect to a MySQL database called opensimdb on the same machine running the simulator (localhost).  The user connecting is opensim with the password h0tgrits.
 +
 
 +
===PostgreSQL===
 +
 
 +
For PostgreSQL you will uncomment the required lines and configure as appropriate.  For instance, the lines
 +
 
 +
<pre>
 +
StorageProvider = "OpenSim.Data.PGSQL.dll"
 +
ConnectionString = "Data Source=localhost;Database=opensimdb;User ID=opensim;Password=h0tgrits;Port=5432;"
 +
</pre>
 +
 
 +
In this case, it will connect to a PostgreSQL database called opensimdb on the same machine running the simulator (localhost).  The user connecting is opensim with the password h0tgrits. If you changed the port number on PostgreSQL installation, you may add to connection string "Port=5432" where 5432 you may change to the installed port.
 +
 
 +
* PostgreSQL database module isn't in 0.7.6 release. It is still on the bleeding edge source code.
 +
 
 +
===SQLite===
 +
 
 +
SQLite is slightly different.  Instead you would uncomment (or leave uncommented) the line.
  
 
Or, you can include another ini files. You'll find a line like that:
 
Or, you can include another ini files. You'll find a line like that:
Line 21: Line 45:
 
Include-Storage = "config-include/storage/SQLiteStandalone.ini";
 
Include-Storage = "config-include/storage/SQLiteStandalone.ini";
 
</pre>
 
</pre>
It means it will go on to read config-include/storage/SQLiteStandalone.ini after reading this ini file. If you open SQLiteStandalone.ini file, you'll find StrageProvider and ConnectionString lines in each sections.
 
  
'''NOTE: There had been another way to connect to MSSQL database, which was using "mssql_connection.ini" in bin/ directory. On OpenSim 0.7.1 or later, it will NOT be read even if you set it properly. Use ConnectionString in *Common.ini instead. For more specific details, see the section [[#MSSQL]].'''
+
This will go on to read config-include/storage/SQLiteStandalone.ini after reading this ini file. If you open SQLiteStandalone.ini file, you'll find StrageProvider and ConnectionString lines in each sections.  As SQLite does not require users or passwords to be setup, there is no further configuration to be done unless you want sqlite to use different filenames for its databases.
 +
 
 +
===MSSQL===
 +
 
 +
'''NOTE: MSSQL support will be removed in OpenSimulator 0.8.1 as it has been unmaintained for more than 2 years and so has bugs and lacks support for recent OpenSimulator features.'''
 +
 
 +
'''NOTE: There had been another way to connect to MSSQL database, which was using "mssql_connection.ini" in bin/ directory. On OpenSimulator 0.7.1 or later, it will NOT be read even if you set it properly. Use ConnectionString in *Common.ini instead. For more specific details, see the section [[#MSSQL]].'''
  
 
== Database Parameters ==
 
== Database Parameters ==
Line 35: Line 64:
 
|-  
 
|-  
 
| StorageProvider
 
| StorageProvider
| "OpenSim.Data.SQLite.dll" (SQLite)<br />"OpenSim.Data.MySQL.dll" (MySQL)<br />"OpenSim.Data.MSSQL.dll" (Microsoft SQL Server)<br />"OpenSim.Data.Null.dll" (disable persistence)
+
| "OpenSim.Data.SQLite.dll" (SQLite)<br />"OpenSim.Data.MySQL.dll" (MySQL)<br />"OpenSim.Data.PGSQL.dll" (PostgreSQL)<br />"OpenSim.Data.MSSQL.dll" (Microsoft SQL Server)<br />"OpenSim.Data.Null.dll" (disable persistence)
| The name of the storage provider modules, which can be found in bin/ folder. The three above are which OpenSim officialy (partially) supports but if you have another providers, you can freely put its name in it. If you choose "OpenSim.Data.Null.dll", OpenSimulator will keep all data in its memory instead of using dataservices.
+
| The name of the storage provider modules, which can be found in bin/ folder. The three above are which OpenSimulator officially support (though MSSQL is partially). If you choose "OpenSim.Data.Null.dll", OpenSimulator will keep all data in its memory instead of using DBMS.
  
 
|-
 
|-
 
| ConnectionString
 
| ConnectionString
 
| See [[#ConnectionString Syntax]]
 
| See [[#ConnectionString Syntax]]
| A string that OpenSim specifies information about a data source. Usually it may include the hostname or ip addresses of database server, database service names, username, schema name and password. The syntax varies between databases.
+
| A string that OpenSimulator specifies information about a data source. Usually it may include the hostname or ip addresses of database server, database service names, username, schema name and password. The syntax varies between databases.
  
 
|-
 
|-
Line 55: Line 84:
 
''Data Source=[1];Database=[2];User ID=[3];Password=[4];Old Guids=true;''
 
''Data Source=[1];Database=[2];User ID=[3];Password=[4];Old Guids=true;''
  
*[1] The hostname or ip address of database server
+
* [1] The hostname or ip address of database server
*[2] Database name
+
* [2] Database name
*[3] Username for the database above
+
* [3] Username for the database above
*[4] Password for the user above
+
* [4] Password for the user above
  
 
Example: If you have created the database "opensim" in localhost, and then created  
 
Example: If you have created the database "opensim" in localhost, and then created  
Line 64: Line 93:
 
<pre>
 
<pre>
 
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensimuser;Password=opensimpassword;Old Guids=true;"
 
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensimuser;Password=opensimpassword;Old Guids=true;"
 +
</pre>
 +
 +
=== PostgreSQL ===
 +
 +
''Data Source=[1];Database=[2];User ID=[3];Password=[4];Port=[5]''
 +
 +
* [1] The hostname or ip address of database server
 +
* [2] Database name
 +
* [3] Username for the database above
 +
* [4] Password for the user above
 +
* [5] Port number for the server (default=5432)
 +
 +
Example: If you have created the database "opensim" in localhost, and then created
 +
the user "opensimuser" and its password is "opensimpassword", and the server port number is 5435 it will be:
 +
<pre>
 +
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensimuser;Password=opensimpassword;Port=5435"
 
</pre>
 
</pre>
  
Line 70: Line 115:
 
''URI=file:[1],version=3,UseUTF16Encoding=True;''
 
''URI=file:[1],version=3,UseUTF16Encoding=True;''
  
*[1] The path to the database file (relative to the bin/ directory - If there is no file on this path, it will be created automatically)
+
* [1] The path to the database file (relative to the bin/ directory - If there is no file on this path, it will be created automatically)
  
 
Example: If you want to create the database for Inventory Service in the directory "bin/db", it will be:
 
Example: If you want to create the database for Inventory Service in the directory "bin/db", it will be:
Line 81: Line 126:
 
''Server=[1];Database=[2];User Id=[3]; password=[4];''
 
''Server=[1];Database=[2];User Id=[3]; password=[4];''
  
*[1] "servername\instance name" - You can see this string in SQL Server Managerment Studio login dialog(Server:).
+
* [1] "servername\instance name" - You can see this string in SQL Server Managerment Studio login dialog(Server:).
*[2] Database name
+
* [2] Database name
*[3] Username for the database above
+
* [3] Username for the database above
*[4] Password for the user above
+
* [4] Password for the user above
  
 
Example: If you have installed Microsoft SQL Server Express Edition with default settings on your local machine
 
Example: If you have installed Microsoft SQL Server Express Edition with default settings on your local machine
Line 92: Line 137:
 
</pre>
 
</pre>
  
== Using Multiple Storages ==
+
== Using different database settings for different services ==
  
Currently there are several services in OpenSim.
+
'''Note: This is extremely advanced configuration and needs to be updated for ROBUST configuration as well as standalone (which is what is implied here).'''
*[InventoryService]
+
*[AssetService]
+
*[AvatarService]
+
*[AuthenticationService]
+
*[UserAccountService]
+
*[GridUserService]
+
*[FriendsService]
+
*[EstateDataStore]
+
*[SimulationDataStore]
+
*[PresenceService]
+
*[AuthorizationService]
+
*[GridService]
+
  
You can use different storage for some service by overriding the same propaties in the section for those service. For example, if you are using OpenSim standalone and want to use MySQL 'opensim' in general but MySQL 'opensim2' for Inventory Service and MSSQL for Authentication Service, you'll need to write in StandaloneCommon.ini like that:
+
Currently there are several services in OpenSimulator.
 +
* [InventoryService]
 +
* [AssetService]
 +
* [AvatarService]
 +
* [AuthenticationService]
 +
* [UserAccountService]
 +
* [GridUserService]
 +
* [FriendsService]
 +
* [EstateDataStore]
 +
* [SimulationDataStore]
 +
* [PresenceService]
 +
* [AuthorizationService]
 +
* [GridService]
 +
 
 +
You can use a different database for each service by overriding the StorageProvider and ConnectionString properties as we saw in the general [DatabaseService] section above. For instance, if you want to use MySQL 'opensim' in general but MySQL 'opensim2' for Inventory Service and MSSQL for Authentication Service, you'll need to write in StandaloneCommon.ini something like:
 
   
 
   
 
<pre>
 
<pre>
Line 124: Line 171:
 
</pre>
 
</pre>
  
If OpenSim can't find StorageProvider or ConnectionString in each service's section, it will use those in [DatabaseService] section. If OpenSim find each or them, it will use the parameter in each service's section. Thus, then the settings in these sections override those in [DatabaseService] section.
+
If OpenSimulator can't find StorageProvider or ConnectionString in each service's section, it will use those in [DatabaseService] section. If OpenSimulator find each or them, it will use the parameter in each service's section. Thus, then the settings in these sections override those in [DatabaseService] section.
  
 
In this case, Inventory Service will:
 
In this case, Inventory Service will:
*read [DatabaseService]StorageProvider
+
* read [DatabaseService]StorageProvider
*read [DatabaseService]ConnectionString -> read [InventoryService]ConnectionString and override
+
* read [DatabaseService]ConnectionString -> read [InventoryService]ConnectionString and override
  
Ahthentication Service will:
+
Authentication Service will:
*read [DatabaseService]StorageProvider -> read [AuthenticationService]StorageProvider and override
+
* read [DatabaseService]StorageProvider -> read [AuthenticationService]StorageProvider and override
*raad [DatabaseService]ConnectionString -> read [AuthenticationService]ConnectionString and override
+
* read [DatabaseService]ConnectionString -> read [AuthenticationService]ConnectionString and override
  
 
Note: SQLite and MSSQL providers don't support some services.
 
Note: SQLite and MSSQL providers don't support some services.
  
Note: For Estate Service, there is another parameter EstateConnectionString in [DatabaseService]. It is the middle priority between [DatabaseService] and [EstateDataStore] ConnectionStrings. OpenSim reads ConnectionString in [DatabaseService] section first, next EstateConnectionString, finally ConnectionString in [EstateDataService] section and overrides.
+
Note: For Estate Service, there is another parameter EstateConnectionString in [DatabaseService]. It is the middle priority between [DatabaseService] and [EstateDataStore] ConnectionStrings. OpenSimulator reads ConnectionString in [DatabaseService] section first, next EstateConnectionString, finally ConnectionString in [EstateDataService] section and overrides.
 
+
  
 
= Quick Setup =
 
= Quick Setup =
Line 143: Line 189:
 
== SQLite Walkthrough ==
 
== SQLite Walkthrough ==
  
By default, OpenSim will automatically create its SQLite database files(*.db) in bin/ directory. You don't need to do anything generally.
+
By default, OpenSimulator will automatically create its SQLite database files(*.db) in bin/ directory. You don't need to do anything generally.
 
If you want to create the database files in another directory, you can change by editing ConnectionString in bin/config-include/storage/SQLiteStandalone.ini included by config-include/*Commons.ini. See [[#SQLite]] section for the detailed syntax.
 
If you want to create the database files in another directory, you can change by editing ConnectionString in bin/config-include/storage/SQLiteStandalone.ini included by config-include/*Commons.ini. See [[#SQLite]] section for the detailed syntax.
  
Line 157: Line 203:
 
On Mac OS X:
 
On Mac OS X:
 
Download DMG package and install it normally. After install the server package, you can even install MySQL Startup Item if you want MySQL to start automatically during system startup. After that, startup your MySQL by following commands. See [http://dev.mysql.com/doc/refman/5.5/en/macosx-installation.html MySQL Documentation] for more details.
 
Download DMG package and install it normally. After install the server package, you can even install MySQL Startup Item if you want MySQL to start automatically during system startup. After that, startup your MySQL by following commands. See [http://dev.mysql.com/doc/refman/5.5/en/macosx-installation.html MySQL Documentation] for more details.
 +
 +
MySQL must be configured to use UTF8 as its default character set. In the config file /etc/my.cnf (Linux) or my.ini (Windows), add these settings:
 +
 +
<pre>
 +
[mysqld]
 +
character-set-server=utf8
 +
 +
[client]
 +
default-character-set=utf8
 +
</pre>
 +
 +
And it's ready to run.
 +
 
<pre>
 
<pre>
 
  $ cd /usr/local/mysql
 
  $ cd /usr/local/mysql
Line 180: Line 239:
 
(enter your password, or if you haven't set password for MySQL server, type "mysql -u root" instead)
 
(enter your password, or if you haven't set password for MySQL server, type "mysql -u root" instead)
 
</pre>
 
</pre>
You can even use MySQL Command Line Client on Start menu on Windows. After login, create user and database for OpenSim.
+
You can even use MySQL Command Line Client on Start menu on Windows. After login, create user and database for OpenSimulator.
 
<pre>
 
<pre>
 
mysql> create database opensim;
 
mysql> create database opensim;
Line 189: Line 248:
 
</pre>
 
</pre>
  
=== Configuring OpenSim ===
+
=== Configuring OpenSimulator ===
 
Open StandaloneCommon.ini or GridCommon.ini with your editor. First, comment-out the line for SQLite.  
 
Open StandaloneCommon.ini or GridCommon.ini with your editor. First, comment-out the line for SQLite.  
 
<pre>
 
<pre>
Line 200: Line 259:
 
StorageProvider = "OpenSim.Data.MySQL.dll"
 
StorageProvider = "OpenSim.Data.MySQL.dll"
 
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensimuser;Password=opensimpassword;Old Guids=true;"
 
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensimuser;Password=opensimpassword;Old Guids=true;"
 +
</pre>
 +
Note that "Data Source=localhost;" actually specifies a TCP socket. If your MySQL server is set up to refuse remote connections (i.e. with skip-networking enabled) you'll need to replace "localhost" with the path to MySQL's UNIX socket.
 +
<pre>
 +
ConnectionString = "Data Source=/var/run/mysqld/mysqld.lock;Database=opensim;User ID=opensimuser;Password=opensimpassword;Old Guids=true;"
 +
</pre>
 +
You can find the path to the socket that your MySQL server is using with mysqladmin.
 +
<pre>
 +
$ mysqladmin -p -u root version
 
</pre>
 
</pre>
  
 
Save and start OpenSimulator. It will access to your new MySQL database instead of the default SQLite databases.
 
Save and start OpenSimulator. It will access to your new MySQL database instead of the default SQLite databases.
 +
 +
== PostgreSQL Walkthrough ==
 +
 +
=== Download ===
 +
Download and install PostgreSQL server from [http://www.postgresql.org/download/ PostgreSQL Downloads Page]. On Linux, you can even fetch "postgresql" with your native package manager.
  
 
== MSSQL Walkthrough ==
 
== MSSQL Walkthrough ==
Line 222: Line 294:
 
Right-click on the Databases node and and select "New Database..." to open "New Database" dialog. In "Database name" field, you provide any names for the new database, which we'll assume is "opensim". In "Owner" field, provide the name of newly created database user("opensimuser" in this tutorial). Accept all defaults and click "OK".
 
Right-click on the Databases node and and select "New Database..." to open "New Database" dialog. In "Database name" field, you provide any names for the new database, which we'll assume is "opensim". In "Owner" field, provide the name of newly created database user("opensimuser" in this tutorial). Accept all defaults and click "OK".
  
=== Configuring OpenSim ===
+
=== Configuring OpenSimulator ===
 
Open StandaloneCommon.ini or GridCommon.ini with your editor. First, comment-out the line for SQLite.  
 
Open StandaloneCommon.ini or GridCommon.ini with your editor. First, comment-out the line for SQLite.  
 
<pre>
 
<pre>
Line 228: Line 300:
 
;Include-Storage = "config-include/storage/SQLiteStandalone.ini";
 
;Include-Storage = "config-include/storage/SQLiteStandalone.ini";
 
</pre>
 
</pre>
After that, add these line in [DatabaseService] section. As of OpenSim 0.7.1, there is no sample configurations for MSSQL(Microsoft SQL Server), so you need to add them by yourself.
+
After that, add these line in [DatabaseService] section. As of OpenSimulator 0.7.1, there is no sample configurations for MSSQL(Microsoft SQL Server), so you need to add them by yourself.
 
<pre>
 
<pre>
 
; MSSQL
 
; MSSQL
Line 236: Line 308:
  
 
Save and start OpenSimulator. It will access to your new SQL Server database instead of the default SQLite databases.
 
Save and start OpenSimulator. It will access to your new SQL Server database instead of the default SQLite databases.
 +
 +
= Additional Settings =
 +
== MySQL ==
 +
MySQL's own configuration is handled in its my.ini file (found in "C:\ProgramData\MySQL\MySQL Server x.y" on recent versions of MySQL on Windows) or my.cnf file (found at /etc/mysql/my.cnf on Ubuntu Linux systems, for instance).
 +
 +
In general, the default configuration is fine for OpenSimulator.  However, you may want to check the max_allowed_packet size.  Very large objects, such as linksets with a very large number of parts or large mesh objects may generate OpenSimulator assets that exceed the default BLOB size that MySQL can store.  On Ubuntu the max_allowed_packet size is 16M, which should be fine.  On Windows MySQL it can be set larger.  In early versions of MySQL [http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html the default is 1M] which may be too small. Windows 5.6 MySQL default is 4M.
 +
 +
Notes: [http://osgrid.org OSGrid] maximum asset size is reported as 45MB at May 2013. [http://vue.ed.ac.uk/openvue/ Openvue] grid maximum asset size is reported as 16MB as at May 2013.
 +
 +
To change this setting, one would add a line like the following in the [mysqld] section of the my.ini or my.cnf file.  E.g.,
 +
 +
max_allowed_packet  = 16M
 +
 +
On Ubuntu 14.04.1 with MySQL latest, this setting was already found to be 16M.
  
 
[[Category:Database]]
 
[[Category:Database]]

Revision as of 17:46, 27 November 2014

If you want to quick know the walkthrough for database setup, see #Quick Setup.

TODO: This page needs to be improved for setting up database usage in Robust, though the config parameters are identical to the StandaloneCommon.ini/GridCommon.ini files.

Contents

Structure

On OpenSimulator 0.7.1 and later, you need to set StorageProvider and ConnectionString so that OpenSimulator can connect to a database. Usually you'll need to edit StandaloneCommon.ini for standalone or GridCommon.ini for grid mode.

In those files, you'll find the [DatabaseService] section. This is where the database is configured. There are number of entries - the only ones that should be uncommented (by removing the beginning semi-colon) are those which apply to the database that you want. All the others must be commented out (by adding a semi-colon to the front of the line).

Examples

MySQL

For MySQL you will uncomment the required lines and configure as appropriate. For instance, the lines

StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=opensimdb;User ID=opensim;Password=h0tgrits;Old Guids=true;"

In this case, it will connect to a MySQL database called opensimdb on the same machine running the simulator (localhost). The user connecting is opensim with the password h0tgrits.

PostgreSQL

For PostgreSQL you will uncomment the required lines and configure as appropriate. For instance, the lines

StorageProvider = "OpenSim.Data.PGSQL.dll"
ConnectionString = "Data Source=localhost;Database=opensimdb;User ID=opensim;Password=h0tgrits;Port=5432;"

In this case, it will connect to a PostgreSQL database called opensimdb on the same machine running the simulator (localhost). The user connecting is opensim with the password h0tgrits. If you changed the port number on PostgreSQL installation, you may add to connection string "Port=5432" where 5432 you may change to the installed port.

  • PostgreSQL database module isn't in 0.7.6 release. It is still on the bleeding edge source code.

SQLite

SQLite is slightly different. Instead you would uncomment (or leave uncommented) the line.

Or, you can include another ini files. You'll find a line like that:

Include-Storage = "config-include/storage/SQLiteStandalone.ini";

This will go on to read config-include/storage/SQLiteStandalone.ini after reading this ini file. If you open SQLiteStandalone.ini file, you'll find StrageProvider and ConnectionString lines in each sections. As SQLite does not require users or passwords to be setup, there is no further configuration to be done unless you want sqlite to use different filenames for its databases.

MSSQL

NOTE: MSSQL support will be removed in OpenSimulator 0.8.1 as it has been unmaintained for more than 2 years and so has bugs and lacks support for recent OpenSimulator features.

NOTE: There had been another way to connect to MSSQL database, which was using "mssql_connection.ini" in bin/ directory. On OpenSimulator 0.7.1 or later, it will NOT be read even if you set it properly. Use ConnectionString in *Common.ini instead. For more specific details, see the section #MSSQL.

Database Parameters

Parameter Possible Values Description
StorageProvider "OpenSim.Data.SQLite.dll" (SQLite)
"OpenSim.Data.MySQL.dll" (MySQL)
"OpenSim.Data.PGSQL.dll" (PostgreSQL)
"OpenSim.Data.MSSQL.dll" (Microsoft SQL Server)
"OpenSim.Data.Null.dll" (disable persistence)
The name of the storage provider modules, which can be found in bin/ folder. The three above are which OpenSimulator officially support (though MSSQL is partially). If you choose "OpenSim.Data.Null.dll", OpenSimulator will keep all data in its memory instead of using DBMS.
ConnectionString See #ConnectionString Syntax A string that OpenSimulator specifies information about a data source. Usually it may include the hostname or ip addresses of database server, database service names, username, schema name and password. The syntax varies between databases.
EstateConnectionString See #ConnectionString Syntax The same as ConnectionString, but it will be used only for Estate Service. (optional)

ConnectionString Syntax

MySQL

Data Source=[1];Database=[2];User ID=[3];Password=[4];Old Guids=true;

  • [1] The hostname or ip address of database server
  • [2] Database name
  • [3] Username for the database above
  • [4] Password for the user above

Example: If you have created the database "opensim" in localhost, and then created the user "opensimuser" and its password is "opensimpassword", it will be:

ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensimuser;Password=opensimpassword;Old Guids=true;"

PostgreSQL

Data Source=[1];Database=[2];User ID=[3];Password=[4];Port=[5]

  • [1] The hostname or ip address of database server
  • [2] Database name
  • [3] Username for the database above
  • [4] Password for the user above
  • [5] Port number for the server (default=5432)

Example: If you have created the database "opensim" in localhost, and then created the user "opensimuser" and its password is "opensimpassword", and the server port number is 5435 it will be:

ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensimuser;Password=opensimpassword;Port=5435"

SQLite

URI=file:[1],version=3,UseUTF16Encoding=True;

  • [1] The path to the database file (relative to the bin/ directory - If there is no file on this path, it will be created automatically)

Example: If you want to create the database for Inventory Service in the directory "bin/db", it will be:

ConnectionString = "URI=file:db/inventory.db,version=3,UseUTF16Encoding=True"

MSSQL

Server=[1];Database=[2];User Id=[3]; password=[4];

  • [1] "servername\instance name" - You can see this string in SQL Server Managerment Studio login dialog(Server:).
  • [2] Database name
  • [3] Username for the database above
  • [4] Password for the user above

Example: If you have installed Microsoft SQL Server Express Edition with default settings on your local machine , created the database "opensim" in localhost, and then created the user "opensimuser" and its password is "opensimpassword", it will be:

ConnectionString = "Server=localhost\SQLEXPRESS;Database=opensim;User Id=opensimuser; password=opensimpassword;"

Using different database settings for different services

Note: This is extremely advanced configuration and needs to be updated for ROBUST configuration as well as standalone (which is what is implied here).

Currently there are several services in OpenSimulator.

  • [InventoryService]
  • [AssetService]
  • [AvatarService]
  • [AuthenticationService]
  • [UserAccountService]
  • [GridUserService]
  • [FriendsService]
  • [EstateDataStore]
  • [SimulationDataStore]
  • [PresenceService]
  • [AuthorizationService]
  • [GridService]

You can use a different database for each service by overriding the StorageProvider and ConnectionString properties as we saw in the general [DatabaseService] section above. For instance, if you want to use MySQL 'opensim' in general but MySQL 'opensim2' for Inventory Service and MSSQL for Authentication Service, you'll need to write in StandaloneCommon.ini something like:

[DatabaseService]
StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;"
...
[InventoryService]
ConnectionString = "Data Source=localhost;Database=opensim2;User ID=opensim;Password=***;Old Guids=true;"
...
[AuthenticationService]
...(another parameters for authentication service)...
StorageProvider = "OpenSim.Data.MSSQL.dll"
ConnectionString = "Data Source=(local);Database=opensim;User=opensim;password=********;"

If OpenSimulator can't find StorageProvider or ConnectionString in each service's section, it will use those in [DatabaseService] section. If OpenSimulator find each or them, it will use the parameter in each service's section. Thus, then the settings in these sections override those in [DatabaseService] section.

In this case, Inventory Service will:

  • read [DatabaseService]StorageProvider
  • read [DatabaseService]ConnectionString -> read [InventoryService]ConnectionString and override

Authentication Service will:

  • read [DatabaseService]StorageProvider -> read [AuthenticationService]StorageProvider and override
  • read [DatabaseService]ConnectionString -> read [AuthenticationService]ConnectionString and override

Note: SQLite and MSSQL providers don't support some services.

Note: For Estate Service, there is another parameter EstateConnectionString in [DatabaseService]. It is the middle priority between [DatabaseService] and [EstateDataStore] ConnectionStrings. OpenSimulator reads ConnectionString in [DatabaseService] section first, next EstateConnectionString, finally ConnectionString in [EstateDataService] section and overrides.

Quick Setup

SQLite Walkthrough

By default, OpenSimulator will automatically create its SQLite database files(*.db) in bin/ directory. You don't need to do anything generally. If you want to create the database files in another directory, you can change by editing ConnectionString in bin/config-include/storage/SQLiteStandalone.ini included by config-include/*Commons.ini. See #SQLite section for the detailed syntax.

MySQL Walkthrough

Download

Download and install "MySQL Community Server" from MySQL Downloads Page. On Linux, you can even fetch "mysql-server" or "mysql-community-server" with your native package manager.

Installing MySQL Server

On Windows: Download MSI and run it. Select "Typical". After installation, it will launch "MySQL Server Instance Configuration Wizard". Select "Standard Configuration". In the next screen, you might be happy later if you check "Include Bin Directory in Windows PATH". In the next screen, provide mysql root password. It will complete settings for mysql and startup its service automatically. See MySQL Documentation for more details.

On Mac OS X: Download DMG package and install it normally. After install the server package, you can even install MySQL Startup Item if you want MySQL to start automatically during system startup. After that, startup your MySQL by following commands. See MySQL Documentation for more details.

MySQL must be configured to use UTF8 as its default character set. In the config file /etc/my.cnf (Linux) or my.ini (Windows), add these settings:

 [mysqld]
 character-set-server=utf8

 [client]
 default-character-set=utf8

And it's ready to run.

 $ cd /usr/local/mysql
 $ sudo ./bin/mysqld_safe
 (enter your password, if necessary)
 (press ctrl-Z)
 $ bg
 (press ctrl-D or enter "exit" to exit the shell)

On Linux: RPM install the downloaded package or install "mysql-server" or "mysql-community-server" with your package manager. For more instructions for installation, see MySQL Documentation. After that, startup your MySQL with following command.

$ /etc/init.d/mysqld start

If you want to startup MySQL server automatically, see 2.10.1.2. Starting and Stopping MySQL Automatically in MySQL 5.5 Reference Manual.

Creating MySQL Database

Now you can configure your MySQL with the command line tools.

$ mysql -u root --password
(enter your password, or if you haven't set password for MySQL server, type "mysql -u root" instead)

You can even use MySQL Command Line Client on Start menu on Windows. After login, create user and database for OpenSimulator.

mysql> create database opensim;
mysql> use opensim;
mysql> create user 'opensimuser'@'localhost' identified by 'opensimpassword';
mysql> grant all on opensim.* to 'opensimuser'@'localhost';
mysql> quit

Configuring OpenSimulator

Open StandaloneCommon.ini or GridCommon.ini with your editor. First, comment-out the line for SQLite.

; SQLite
;Include-Storage = "config-include/storage/SQLiteStandalone.ini";

After that, uncomment StorageProvider and ConnectionString property lines in [DatabaseService] section and change the line like that:

; MySql
StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensimuser;Password=opensimpassword;Old Guids=true;"

Note that "Data Source=localhost;" actually specifies a TCP socket. If your MySQL server is set up to refuse remote connections (i.e. with skip-networking enabled) you'll need to replace "localhost" with the path to MySQL's UNIX socket.

ConnectionString = "Data Source=/var/run/mysqld/mysqld.lock;Database=opensim;User ID=opensimuser;Password=opensimpassword;Old Guids=true;"

You can find the path to the socket that your MySQL server is using with mysqladmin.

$ mysqladmin -p -u root version

Save and start OpenSimulator. It will access to your new MySQL database instead of the default SQLite databases.

PostgreSQL Walkthrough

Download

Download and install PostgreSQL server from PostgreSQL Downloads Page. On Linux, you can even fetch "postgresql" with your native package manager.

MSSQL Walkthrough

Download

To download Microsoft SQL Server 2008 Express edition: [1] Make sure you download Microsoft SQL Server 2008 Express with Tools ([2]) since you will likely want a nice tool to work with your database. If you already downloaded Microsoft SQL Server before, skip to "Checking Instance Configurations" step.

Installing Microsoft SQL Server

Double-click the downloaded executable and select click Installation and "New SQL Server stand-alone installation or add features to an existing installation". It will start installation process, you only need to click "OK", "Next" or "Install" until you come across the "Feature Selection". In this screen, you need to check "Database Engine Service" and "Management Tools - Basic", then click "Next". In next screen "Instance Configuration", check what is filled in "Named instance:" property - you will later use this later. For example, for default Express Edition, you'll see "SQLEXPRESS". Click "Next". Then go on default until you reach "Server Configuration". In this screen, fill in Account Name and Password field with you windows login name and password. In next "Database Engine Configuration" screen, you will need to enable Mixed Mode. After that provide password, click "Add Current User", and then continue clicking "Next" or "OK" until it completes the installation process. After that, you'll find the entry "SQL Server Managerment Studio" in "Microsoft SQL Server 2008" on the Windows Start menu. Open it and click "connect" to connect to your instance.

Checking Instance Configurations

Right-click on your database server in Management Studio and select Properties, then go to the Security tab and select SQL Server and Windows Authentication mode, click OK. If you have already installed SQL Server before and you find "Windows Authentication mode" enabled instead, change it.

Creating User for Database

Expand the Security node, then right-click the Logins node. Select "New Login..." to open "Login - New" dialog. In this screen, fill "Login name" with the string whatever you like, select "SQL Server authentication", give it a strong password, uncheck "User must change password at next login", and click "OK". In this tutorial, we'll assume you have typed "opensimuser" for Login name, and "opensimpassword" for password.

Creating Database

Right-click on the Databases node and and select "New Database..." to open "New Database" dialog. In "Database name" field, you provide any names for the new database, which we'll assume is "opensim". In "Owner" field, provide the name of newly created database user("opensimuser" in this tutorial). Accept all defaults and click "OK".

Configuring OpenSimulator

Open StandaloneCommon.ini or GridCommon.ini with your editor. First, comment-out the line for SQLite.

; SQLite
;Include-Storage = "config-include/storage/SQLiteStandalone.ini";

After that, add these line in [DatabaseService] section. As of OpenSimulator 0.7.1, there is no sample configurations for MSSQL(Microsoft SQL Server), so you need to add them by yourself.

; MSSQL
StorageProvider = "OpenSim.Data.MSSQL.dll"
ConnectionString = "Server=localhost\SQLEXPRESS;Database=opensim;User Id=opensimuser; password=opensimpassword;"

Save and start OpenSimulator. It will access to your new SQL Server database instead of the default SQLite databases.

Additional Settings

MySQL

MySQL's own configuration is handled in its my.ini file (found in "C:\ProgramData\MySQL\MySQL Server x.y" on recent versions of MySQL on Windows) or my.cnf file (found at /etc/mysql/my.cnf on Ubuntu Linux systems, for instance).

In general, the default configuration is fine for OpenSimulator. However, you may want to check the max_allowed_packet size. Very large objects, such as linksets with a very large number of parts or large mesh objects may generate OpenSimulator assets that exceed the default BLOB size that MySQL can store. On Ubuntu the max_allowed_packet size is 16M, which should be fine. On Windows MySQL it can be set larger. In early versions of MySQL the default is 1M which may be too small. Windows 5.6 MySQL default is 4M.

Notes: OSGrid maximum asset size is reported as 45MB at May 2013. Openvue grid maximum asset size is reported as 16MB as at May 2013.

To change this setting, one would add a line like the following in the [mysqld] section of the my.ini or my.cnf file. E.g.,

max_allowed_packet  = 16M

On Ubuntu 14.04.1 with MySQL latest, this setting was already found to be 16M.

Personal tools
General
About This Wiki