此内容没有您所选择的语言版本。
18.5. LevelDB Cache Store
LevelDB is a key-value storage engine that provides an ordered mapping from string keys to string values.
The LevelDB Cache Store uses two filesystem directories. Each directory is configured for a LevelDB database. One directory stores the non-expired data and the second directory stores the expired keys before a purge.
Procedure 18.1. To configure LevelDB Cache Store:
- Add the following elements to a cache definition in
standalone.xmlto configure the database:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
For details about the elements and parameters used in this sample configuration, see Section 18.3, “Cache Store Configuration Details (Remote Client-Server Mode)”.
18.5.2. LevelDB Cache Store Programmatic Configuration 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The following is a sample programmatic configuration of LevelDB Cache Store:
Configuration cacheConfig = new ConfigurationBuilder().persistence()
.addStore(LevelDBStoreConfigurationBuilder.class)
.location("/tmp/leveldb/data")
.expiredLocation("/tmp/leveldb/expired").build();
Configuration cacheConfig = new ConfigurationBuilder().persistence()
.addStore(LevelDBStoreConfigurationBuilder.class)
.location("/tmp/leveldb/data")
.expiredLocation("/tmp/leveldb/expired").build();
Procedure 18.2. LevelDB Cache Store programmatic configuration
- Use the
ConfigurationBuilderto create a new configuration object. - Add the store to the
LevelDBCacheStoreConfigurationBuilderinstance to build its configuration. - Set the LevelDB Cache Store location path. The specified path stores the primary cache store data. The directory is automatically created if it does not exist.
- Specify the location for expired data using the
expiredLocationparameter for the LevelDB Store. The specified path stores expired data before it is purged. The directory is automatically created if it does not exist.
Note
Programmatic configurations can only be used with Red Hat JBoss Data Grid Library mode.
The following is a sample XML configuration of LevelDB Cache Store:
For details about the elements and parameters used in this sample configuration, see Section 18.2, “Cache Store Configuration Details (Library Mode)”.
Use the following procedure to set up a new LevelDB cache store using the JBoss Operations Network.
Procedure 18.3.
- Ensure that Red Hat JBoss Operations Network 3.2 or better is installed and started.
- Install the Red Hat JBoss Data Grid Plugin Pack for JBoss Operations Network 3.2.0.
- Ensure that JBoss Data Grid is installed and started.
- Import JBoss Data Grid server into the inventory.
- Configure the JBoss Data Grid connection settings.
- Create a new LevelDB cache store as follows:
Figure 18.1. Create a new LevelDB Cache Store
- Right-click the
defaultcache. - In the menu, mouse over the option.
- In the submenu, click .
- Name the new LevelDB cache store as follows:
Figure 18.2. Name the new LevelDB Cache Store
- In the Resource Create Wizard that appears, add a name for the new LevelDB Cache Store.
- Click to continue.
- Configure the LevelDB Cache Store settings as follows:
Figure 18.3. Configure the LevelDB Cache Store Settings
- Use the options in the configuration window to configure a new LevelDB cache store.
- Click to complete the configuration.
- Schedule a restart operation as follows:
Figure 18.4. Schedule a Restart Operation
- In the screen's left panel, expand the JBossAS7 Standalone Servers entry, if it is not currently expanded.
- Click JDG (0.0.0.0:9990) from the expanded menu items.
- In the screen's right panel, details about the selected server display. Click the tab.
- In the Operation drop-down box, select the Restart operation.
- Select the radio button for the Now entry.
- Click to restart the server immediately.
- Discover the new LevelDB cache store as follows:
Figure 18.5. Discover the New LevelDB Cache Store
- In the screen's left panel, select each of the following items in the specified order to expand them:
- Click the name of your new LevelDB Cache Store to view its configuration information in the right panel.