You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by "Rafal G." <gl...@gmail.com> on 2016/01/18 23:12:42 UTC
Best place to set: ALLOW_PERSISTENT_TRANSACTIONS
Hi,
What is the best place to set: ALLOW_PERSISTENT_TRANSACTIONS property?
Rafal
Re: Best place to set: ALLOW_PERSISTENT_TRANSACTIONS
Posted by "Rafal G." <gl...@gmail.com>.
John - thanks for the examples. I think I will have to create custom shell
scripts to start up nodes so I don't miss anything important on the startup.
Just browsed the sources, it (ALLOW_PERSISTENT_TRANSACTIONS) is used as a
flag in 2 places (static and final, initialized on class loading) and it
would be a rather nasty hack to try to replace it now with regular
gemfire.propeties entry :/
Re: Best place to set: ALLOW_PERSISTENT_TRANSACTIONS
Posted by John Blum <jb...@pivotal.io>.
When using GemFire programmatically (e.g. embedded), you can use the
CacheFactory API (server-side)...
// Peer Cache
Cache peerCache = new CacheFactory()
.set("name", "server1")
* .set("ALLOW_PERSISTENT_TRANSACTIONS", "true")*
...
.create();
Otherwise, you would (normally) use the standard GemFire properties files (
gemfire.properties
<http://gemfire.docs.pivotal.io/docs-gemfire/reference/topics/gemfire_properties.html>
[0])
on the server (or a client for that matter) in 1 of the designated
locations...
* user home directory
* working directory of the GemFire Server process (as designated with
gfsh>start
server ... *--dir=...*; defaults to a sub-directory under Gfsh's working
directory named after the server (e.g. "server1")
* explicitly referenced in *Gfsh* start server command's *--properties-file*
=<absolute-or-relative-to-server-working-dir-path-to-gemfire-properties-file>
option
* Additionally, GemFire has another System property to specify the location
of the properties file *-DgemfirePropertyFile*=... (in fact, this is what
*Gfsh* uses under-the-hoood when forking the GemFire Server process
using 'start
server ... *--properties-file*').
Internally, the file would contain GemFire System properties without the "
gemfire." prefix, like so...
// gemfire.properties
name=server1
...
Unfortunately, I do not think you can set...
ALLOW_PERSISTENT_TRANSACTIONS=true
In a gemfire.properties file, due to ALLOW_PERSISTENT_TRANSACTIONS not
being 1 of the standard GemFire System properties
<http://gemfire.docs.pivotal.io/docs-gemfire/reference/topics/gemfire_properties.html>
[0].
[0] -
http://gemfire.docs.pivotal.io/docs-gemfire/reference/topics/gemfire_properties.html
On Mon, Jan 18, 2016 at 2:46 PM, Rafal G. <gl...@gmail.com> wrote:
> I am using gfsh + start server (just as John has shown) currently and it
> does work. I was hoping for a more intuitive place, like gemfire.properties
> for example.
> Thanks for the hints on Spring Data GF but I will be using pure
> client/server mode (way too much data) so I think settings such properties
> on the client would not do it, would it?
>
> 2016-01-18 23:37 GMT+01:00 John Blum <jb...@pivotal.io>:
>
>> Hi Rafal-
>>
>> The following reference from the GemFire User Guide shows setting this
>> GemFire System property via Gfsh on the command line...
>>
>>
>> http://gemfire.docs.pivotal.io/docs-gemfire/latest/developing/transactions/cache_transactions_by_region_type.html#concept_omy_341_wk
>>
>> Like so...
>>
>> gfsh start server --name=server1 --dir=server1_dir \
>> --J=-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true
>>
>>
>> Alternatively, when using Spring (Data GemFire) configuration meta-data
>> (e.g. XML), you can do the following...
>>
>> <util:properties id="gemfireProperties">
>> <prop key="name">server1</prop>
>> <prop key="mcast-port">0</prop>
>> <prop key="log-level">warning</prop>
>> * <prop key="ALLOW_PERSISTENT_TRANSACTIONS">true</prop>*
>> </util:properties>
>>
>> <gfe:cache properties-ref="gemfireProperties"/>
>>
>>
>> Or better yet, perhaps with Spring Java Configuration...
>>
>>
>> public class Config {
>>
>> @Bean
>> Properties gemfireProperties() {
>> Properties gemfireProperties = new Properties();
>>
>> gemfireProperties.setProperty("name", "server1");
>> gemfireProperties.setProperty("mcast-port", "0");
>> gemfireProperties.setProperty("log-level", "warning");
>> * gemfireProperties.setProperty("ALLOW_PERSISTENT_TRANSACTIONS",
>> "true");*
>>
>> return gemfireProperties;
>> }
>>
>> @Bean
>> CacheFactoryBean gemfireCache() {
>> CacheFactoryBean gemfireCache = new CacheFactoryBean();
>>
>> gemfireCache.setLazyInitialize(false);
>> gemfireCache.setProperties(gemfireProperties());
>> gemfireCache.setUseBeanFactoryLocator(false);
>>
>> return gemfireCache;
>> }
>> }
>>
>> Hope this helps.
>>
>> Cheers,
>> John
>>
>>
>> On Mon, Jan 18, 2016 at 2:12 PM, Rafal G. <gl...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> What is the best place to set: ALLOW_PERSISTENT_TRANSACTIONS property?
>>>
>>> Rafal
>>>
>>
>>
>>
>> --
>> -John
>> 503-504-8657
>> john.blum10101 (skype)
>>
>
>
--
-John
503-504-8657
john.blum10101 (skype)
Re: Best place to set: ALLOW_PERSISTENT_TRANSACTIONS
Posted by "Rafal G." <gl...@gmail.com>.
I am using gfsh + start server (just as John has shown) currently and it
does work. I was hoping for a more intuitive place, like gemfire.properties
for example.
Thanks for the hints on Spring Data GF but I will be using pure
client/server mode (way too much data) so I think settings such properties
on the client would not do it, would it?
2016-01-18 23:37 GMT+01:00 John Blum <jb...@pivotal.io>:
> Hi Rafal-
>
> The following reference from the GemFire User Guide shows setting this
> GemFire System property via Gfsh on the command line...
>
>
> http://gemfire.docs.pivotal.io/docs-gemfire/latest/developing/transactions/cache_transactions_by_region_type.html#concept_omy_341_wk
>
> Like so...
>
> gfsh start server --name=server1 --dir=server1_dir \
> --J=-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true
>
>
> Alternatively, when using Spring (Data GemFire) configuration meta-data
> (e.g. XML), you can do the following...
>
> <util:properties id="gemfireProperties">
> <prop key="name">server1</prop>
> <prop key="mcast-port">0</prop>
> <prop key="log-level">warning</prop>
> * <prop key="ALLOW_PERSISTENT_TRANSACTIONS">true</prop>*
> </util:properties>
>
> <gfe:cache properties-ref="gemfireProperties"/>
>
>
> Or better yet, perhaps with Spring Java Configuration...
>
>
> public class Config {
>
> @Bean
> Properties gemfireProperties() {
> Properties gemfireProperties = new Properties();
>
> gemfireProperties.setProperty("name", "server1");
> gemfireProperties.setProperty("mcast-port", "0");
> gemfireProperties.setProperty("log-level", "warning");
> * gemfireProperties.setProperty("ALLOW_PERSISTENT_TRANSACTIONS",
> "true");*
>
> return gemfireProperties;
> }
>
> @Bean
> CacheFactoryBean gemfireCache() {
> CacheFactoryBean gemfireCache = new CacheFactoryBean();
>
> gemfireCache.setLazyInitialize(false);
> gemfireCache.setProperties(gemfireProperties());
> gemfireCache.setUseBeanFactoryLocator(false);
>
> return gemfireCache;
> }
> }
>
> Hope this helps.
>
> Cheers,
> John
>
>
> On Mon, Jan 18, 2016 at 2:12 PM, Rafal G. <gl...@gmail.com>
> wrote:
>
>> Hi,
>>
>> What is the best place to set: ALLOW_PERSISTENT_TRANSACTIONS property?
>>
>> Rafal
>>
>
>
>
> --
> -John
> 503-504-8657
> john.blum10101 (skype)
>
Re: Best place to set: ALLOW_PERSISTENT_TRANSACTIONS
Posted by John Blum <jb...@pivotal.io>.
NOTE: minor typo... all *Spring* configuration classes using *Spring*
annotations (e.g. @Bean) should include the class-level, type meta-data
annotation, @Configuration, like so...
*@Configuration*
public class Config {
...
}
On Mon, Jan 18, 2016 at 2:37 PM, John Blum <jb...@pivotal.io> wrote:
> Hi Rafal-
>
> The following reference from the GemFire User Guide shows setting this
> GemFire System property via Gfsh on the command line...
>
>
> http://gemfire.docs.pivotal.io/docs-gemfire/latest/developing/transactions/cache_transactions_by_region_type.html#concept_omy_341_wk
>
> Like so...
>
> gfsh start server --name=server1 --dir=server1_dir \
> --J=-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true
>
>
> Alternatively, when using Spring (Data GemFire) configuration meta-data
> (e.g. XML), you can do the following...
>
> <util:properties id="gemfireProperties">
> <prop key="name">server1</prop>
> <prop key="mcast-port">0</prop>
> <prop key="log-level">warning</prop>
> * <prop key="ALLOW_PERSISTENT_TRANSACTIONS">true</prop>*
> </util:properties>
>
> <gfe:cache properties-ref="gemfireProperties"/>
>
>
> Or better yet, perhaps with Spring Java Configuration...
>
>
> public class Config {
>
> @Bean
> Properties gemfireProperties() {
> Properties gemfireProperties = new Properties();
>
> gemfireProperties.setProperty("name", "server1");
> gemfireProperties.setProperty("mcast-port", "0");
> gemfireProperties.setProperty("log-level", "warning");
> * gemfireProperties.setProperty("ALLOW_PERSISTENT_TRANSACTIONS",
> "true");*
>
> return gemfireProperties;
> }
>
> @Bean
> CacheFactoryBean gemfireCache() {
> CacheFactoryBean gemfireCache = new CacheFactoryBean();
>
> gemfireCache.setLazyInitialize(false);
> gemfireCache.setProperties(gemfireProperties());
> gemfireCache.setUseBeanFactoryLocator(false);
>
> return gemfireCache;
> }
> }
>
> Hope this helps.
>
> Cheers,
> John
>
>
> On Mon, Jan 18, 2016 at 2:12 PM, Rafal G. <gl...@gmail.com>
> wrote:
>
>> Hi,
>>
>> What is the best place to set: ALLOW_PERSISTENT_TRANSACTIONS property?
>>
>> Rafal
>>
>
>
>
> --
> -John
> 503-504-8657
> john.blum10101 (skype)
>
--
-John
503-504-8657
john.blum10101 (skype)
Re: Best place to set: ALLOW_PERSISTENT_TRANSACTIONS
Posted by John Blum <jb...@pivotal.io>.
Hi Rafal-
The following reference from the GemFire User Guide shows setting this
GemFire System property via Gfsh on the command line...
http://gemfire.docs.pivotal.io/docs-gemfire/latest/developing/transactions/cache_transactions_by_region_type.html#concept_omy_341_wk
Like so...
gfsh start server --name=server1 --dir=server1_dir \
--J=-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true
Alternatively, when using Spring (Data GemFire) configuration meta-data
(e.g. XML), you can do the following...
<util:properties id="gemfireProperties">
<prop key="name">server1</prop>
<prop key="mcast-port">0</prop>
<prop key="log-level">warning</prop>
* <prop key="ALLOW_PERSISTENT_TRANSACTIONS">true</prop>*
</util:properties>
<gfe:cache properties-ref="gemfireProperties"/>
Or better yet, perhaps with Spring Java Configuration...
public class Config {
@Bean
Properties gemfireProperties() {
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("name", "server1");
gemfireProperties.setProperty("mcast-port", "0");
gemfireProperties.setProperty("log-level", "warning");
* gemfireProperties.setProperty("ALLOW_PERSISTENT_TRANSACTIONS",
"true");*
return gemfireProperties;
}
@Bean
CacheFactoryBean gemfireCache() {
CacheFactoryBean gemfireCache = new CacheFactoryBean();
gemfireCache.setLazyInitialize(false);
gemfireCache.setProperties(gemfireProperties());
gemfireCache.setUseBeanFactoryLocator(false);
return gemfireCache;
}
}
Hope this helps.
Cheers,
John
On Mon, Jan 18, 2016 at 2:12 PM, Rafal G. <gl...@gmail.com> wrote:
> Hi,
>
> What is the best place to set: ALLOW_PERSISTENT_TRANSACTIONS property?
>
> Rafal
>
--
-John
503-504-8657
john.blum10101 (skype)
Re: Best place to set: ALLOW_PERSISTENT_TRANSACTIONS
Posted by Udo Kohlmeyer <uk...@pivotal.io>.
Hi Rafal,
I'm not sure what you mean by this statement... But the best place to
set this property would be as a JVM property as
-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true/false.
Could you possibly provide your method you are using to start Geode.
Maybe we could be of more help if we have a little more context.
--Udo
On 19/01/2016 9:12 am, Rafal G. wrote:
> Hi,
>
> What is the best place to set: ALLOW_PERSISTENT_TRANSACTIONS property?
>
> Rafal