apache-ignite

Форк
0
/
understanding-configuration.adoc 
111 строк · 4.5 Кб
1
// Licensed to the Apache Software Foundation (ASF) under one or more
2
// contributor license agreements.  See the NOTICE file distributed with
3
// this work for additional information regarding copyright ownership.
4
// The ASF licenses this file to You under the Apache License, Version 2.0
5
// (the "License"); you may not use this file except in compliance with
6
// the License.  You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
= Understanding Configuration
16

17
This chapter explains different ways of setting configuration parameters in an Ignite cluster. The chapter covers the most
18
ubiquitous approaches for Java and C++ applications.
19

20
[NOTE]
21
====
22
[discrete]
23
=== Configuring .NET, Python, Node.JS and other programming languages
24

25
* .NET developers: refer to the link:net-specific/net-configuration-options[Ignite.NET Configuration] section
26
* Developers of Python, Node.JS, and other programming languages: use this page to configure your
27
Java-powered Ignite cluster and link:thin-clients/getting-started-with-thin-clients[thin clients] section to set up
28
your language-specific applications that will be working with the cluster.
29
====
30

31
== Overview
32

33
You can specify custom configuration parameters by providing an instance of the javadoc:org.apache.ignite.configuration.IgniteConfiguration[] class to Ignite when starting the node.
34
You can set the parameters either programmatically or via an XML configuration file.
35
These 2 ways are fully interchangeable.
36

37
The XML configuration file is a Spring Bean definition file that must contain the `IgniteConfiguration` bean.
38
When starting a node from the command line, pass the configuration file as a parameter to the `ignite.sh|bat` script, as follows:
39

40
[source,shell]
41
----
42
ignite.sh ignite-config.xml
43
----
44

45
If you don't specify a configuration file, the default file `{IGNITE_HOME}/config/default-config.xml` is used.
46

47
== Spring XML Configuration
48

49
To create a configuration in a Spring XML format, you need to define the
50
`IgniteConfiguration` bean and set the parameters that you want to be different from the default. For detailed information on how to use XML Schema-based configuration, see the
51
https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/html/xsd-configuration.html[official
52
Spring documentation].
53

54
In the example below, we create an `IgniteConfiguration` bean, set the `workDirectory` property, and configure a link:data-modeling/data-partitioning#partitioned[partitioned cache].
55

56
[source,xml]
57
----
58
<?xml version="1.0" encoding="UTF-8"?>
59

60
<beans xmlns="http://www.springframework.org/schema/beans"
61
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
62
       xsi:schemaLocation="
63
        http://www.springframework.org/schema/beans
64
        http://www.springframework.org/schema/beans/spring-beans.xsd">
65

66
    <bean class="org.apache.ignite.configuration.IgniteConfiguration">
67
        <property name="workDirectory" value="/path/to/work/directory"/>
68

69
        <property name="cacheConfiguration">
70
            <bean class="org.apache.ignite.configuration.CacheConfiguration">
71
                <!-- Set the cache name. -->
72
                <property name="name" value="myCache"/>
73
                <!-- Set the cache mode. -->
74
                <property name="cacheMode" value="PARTITIONED"/>
75
                <!-- Other cache parameters. -->
76
            </bean>
77
        </property>
78
    </bean>
79
</beans>
80
----
81

82
== Programmatic Configuration
83

84
Create an instance of the `IgniteConfiguration` class and set the required
85
parameters, as shown in the example below.
86

87
[tabs]
88
--
89

90
tab:Java[]
91
[source,java]
92
----
93
include::{javaCodeDir}/UnderstandingConfiguration.java[tag=cfg,indent=0]
94
----
95

96
See the link:{javadoc_base_url}/org/apache/ignite/configuration/IgniteConfiguration.html[IgniteConfiguration,window=_blank] javadoc for the complete list of parameters.
97

98
tab:C#/.NET[]
99
[source,csharp]
100
----
101
include::code-snippets/dotnet/UnderstandingConfiguration.cs[tag=UnderstandingConfigurationProgrammatic,indent=0]
102
----
103

104
See the https://ignite.apache.org/releases/{version}/dotnetdoc/api/Apache.Ignite.Core.IgniteConfiguration.html[API docs,window=_blank] for details.
105

106
tab:C++[]
107
[source,cpp]
108
----
109
include::code-snippets/cpp/src/setting_work_directory.cpp[tag=setting-work-directory,indent=0]
110
----
111
--
112

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.