20 Temmuz 2023 Perşembe

hazelcast.xml - Data Connection Ayarları

Giriş
XML ile eklenen Data Connection bir daha silinemez

Örnek - JDBC
Şöyle yaparız
<hazelcast>
  <data-connection name="my-mysql-database">
    <type>JDBC</type>
    <properties>
      <property name="jdbcUrl">jdbc:mysql://mysql.example.org:3306</property> 
      <property name="user">my_user</property> 
      <property name="password">my_password</property>
    </properties>
    <shared>true</shared>
  </data-connection>
</hazelcast>

Örnek - Mongo
Şöyle yaparız
hazelcast:
  data-connection:
    my-mongodb:
      type: Mongo
      properties:
        connectionString: mongodb+srv://myusername:mypass@foo.mongodb.net/?retryWrites=true&w=majority
        database: hazelcast
        collection: supplements
      shared: true
  map:
    supplements:
      map-store:
        enabled: true
        class-name: com.hazelcast.mapstore.GenericMapStore
        properties:
          data-connection-ref: my-mongodb
Açıklaması şöyle
mongodb+srv: - The scheme that indicates this is a connection string for MongoDB Atlas.
myusername - The username for the user that will be connecting to the database.
mypass - The password for the user that will be connecting to the database.
foo.mongodb.net - The hostname of the MongoDB Atlas cluster.
retryWrites=true - Indicates that the driver should retry writes if they fail.
w=majority - Indicates that the driver should wait for a majority of nodes in the cluster to acknowledge a write before returning.


Hiç yorum yok:

Yorum Gönder

THIRD-PARTY.txt Dosyası

Kullanılan harici kütüphanelerin sürümleri bu dosyada Dosyanın yolu şöyle hazelcast/licenses/THIRD-PARTY.txt