chore(*): start all
This commit is contained in:
commit
df4e121b4e
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM hazelcast/hazelcast:3.12.10
|
||||||
|
|
||||||
|
# Копируем файлы конфигурации в контейнер
|
||||||
|
COPY ./hazelcast.xml /opt/hazelcast/
|
||||||
|
COPY ./jmx_agent_config.yaml /opt/prometheus/
|
||||||
|
|
||||||
|
ENV JAVA_OPTS="-Dhazelcast.config=/opt/hazelcast/hazelcast.xml -Dhazelcast.jmx=true -Djava.rmi.server.hostname=onaintdata1"
|
||||||
|
ENV PROMETHEUS_PORT=9100
|
||||||
|
ENV PROMETHEUS_CONFIG="/opt/prometheus/jmx_agent_config.yaml"
|
||||||
|
ENV MIN_HEAP_SIZE=1228m
|
||||||
|
ENV MAX_HEAP_SIZE=1228m
|
||||||
|
|
||||||
|
EXPOSE 5701 9100
|
||||||
21
hazelcast.xml
Normal file
21
hazelcast.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.8.xsd" xmlns="http://www.hazelcast.com/schema/config">
|
||||||
|
<group>
|
||||||
|
<name>ona</name>
|
||||||
|
<password>123456</password>
|
||||||
|
</group>
|
||||||
|
<network>
|
||||||
|
<public-address>onaintdata1</public-address>
|
||||||
|
<port auto-increment="false">5701</port>
|
||||||
|
<join>
|
||||||
|
<multicast enabled="false"></multicast>
|
||||||
|
<tcp-ip enabled="true">
|
||||||
|
<member>onaintdata1:5701</member>
|
||||||
|
</tcp-ip>
|
||||||
|
</join>
|
||||||
|
</network>
|
||||||
|
<properties>
|
||||||
|
<property name="hazelcast.rest.enabled">true</property>
|
||||||
|
<property name="hazelcast.socket.bind.any">true</property>
|
||||||
|
<property name="hazelcast.jmx">true</property>
|
||||||
|
</properties>
|
||||||
|
</hazelcast>
|
||||||
20
jmx_agent_config.yaml
Normal file
20
jmx_agent_config.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
ssl: false
|
||||||
|
whitelistObjectNames: ["com.hazelcast:*"]
|
||||||
|
rules:
|
||||||
|
- pattern: '<instance=([\w-_]+), name=([\w-_\.]+), type=(.*)><>(.*):'
|
||||||
|
name: hazelcast_$3_$4
|
||||||
|
labels:
|
||||||
|
instance: $1
|
||||||
|
name: $2
|
||||||
|
type: $3
|
||||||
|
help: "Hazelcast metric instance=$1 name=$2 type=$3 attribute=$4"
|
||||||
|
attrNameSnakeCase: false
|
||||||
|
- pattern: '<name=([\w-_\.]+), instance=([\w-_]+), type=(\w+.*):'
|
||||||
|
name: hazelcast_$3
|
||||||
|
labels:
|
||||||
|
name: $1
|
||||||
|
instance: $2
|
||||||
|
type: $3
|
||||||
|
help: "Hazelcast metric instance=$2 name=$1 type=$3"
|
||||||
|
attrNameSnakeCase: false
|
||||||
1
js/.gitignore
vendored
Normal file
1
js/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
53
js/index.js
Normal file
53
js/index.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
const Haz = require('hazelcast-client');
|
||||||
|
// const config = new Haz.Config.ClientConfig();
|
||||||
|
let globalClient = null;
|
||||||
|
|
||||||
|
// config.listeners.addLifecycleListener(function (state) {
|
||||||
|
// console.log('Lifecycle Event >>> ' + state);
|
||||||
|
// if(state === 'shutdown'){
|
||||||
|
// console.log('WE ARE DEAD!');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
const cfg = {
|
||||||
|
network: {
|
||||||
|
clusterMembers: [
|
||||||
|
'127.0.0.1:5701',
|
||||||
|
]
|
||||||
|
},
|
||||||
|
groupConfig: {
|
||||||
|
name: 'ona',
|
||||||
|
password: '123456'
|
||||||
|
},
|
||||||
|
lifecycleListeners: [
|
||||||
|
(state) => {
|
||||||
|
console.log(`Hazelcast lifecycle Event >>> ${state}`);
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = new Haz.Config.ClientConfig(cfg);
|
||||||
|
|
||||||
|
Haz.Client.newHazelcastClient(config).then((client) => {
|
||||||
|
console.log('Success!', client);
|
||||||
|
globalClient = client;
|
||||||
|
console.log(globalClient.getLocalEndpoint());
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
setInterval(async () => {
|
||||||
|
try{
|
||||||
|
console.log('Client >>>>>>');
|
||||||
|
|
||||||
|
if(globalClient){
|
||||||
|
const map = await globalClient.getMap('qqz');
|
||||||
|
console.log('value: ', await map.put('q', Date.now()));
|
||||||
|
}
|
||||||
|
}catch(e) {
|
||||||
|
console.log('>>>>>>>>>>>>>>>>>', e)
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
9
js/package.json
Normal file
9
js/package.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "hazelcast-test",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"hazelcast-client": "3.12.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
27
js/yarn.lock
Normal file
27
js/yarn.lock
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
bluebird@3.7.2:
|
||||||
|
version "3.7.2"
|
||||||
|
resolved "http://binary.moscow.alfaintra.net/artifactory/api/npm/npm/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
|
||||||
|
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
|
||||||
|
|
||||||
|
hazelcast-client@3.12.4:
|
||||||
|
version "3.12.4"
|
||||||
|
resolved "http://binary.moscow.alfaintra.net/artifactory/api/npm/npm/hazelcast-client/-/hazelcast-client-3.12.4.tgz#a34d0f59b26a7277bd05373818729af0547f4562"
|
||||||
|
integrity sha512-o/0zkY//1P0A3j/x4Zh3kCwKIh38Uiqd9kCRcWqa3IYm9zAs9iyL+Ml6f0+eUwWOjrGNVlthXvxe9lijhzpqug==
|
||||||
|
dependencies:
|
||||||
|
bluebird "3.7.2"
|
||||||
|
long "4.0.0"
|
||||||
|
safe-buffer "5.2.1"
|
||||||
|
|
||||||
|
long@4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "http://binary.moscow.alfaintra.net/artifactory/api/npm/npm/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
|
||||||
|
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==
|
||||||
|
|
||||||
|
safe-buffer@5.2.1:
|
||||||
|
version "5.2.1"
|
||||||
|
resolved "http://binary.moscow.alfaintra.net/artifactory/api/npm/npm/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
||||||
|
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
||||||
Loading…
x
Reference in New Issue
Block a user