mirror of
https://github.com/yacy/yacy_search_server.git
synced 2026-10-25 05:54:15 +00:00
removed hazelcast because it is phoning home, see also:
https://github.com/yacy/yacy_search_server/issues/504
This commit is contained in:
1 parent
fc98ca7a9c
commit
9c1bc533fa
4 files changed
-124
No files matched your search
@@ -1,93 +0,0 @@
|
||||
// localpeers.java
|
||||
// ------------
|
||||
// (C) 2021 by Michael Peter Christen; mc@yacy.net
|
||||
// first published 23.01.2021 on http://yacy.net
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hazelcast.cluster.Member;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
|
||||
import net.yacy.cora.protocol.RequestHeader;
|
||||
import net.yacy.cora.util.Memory;
|
||||
import net.yacy.search.Switchboard;
|
||||
import net.yacy.server.serverObjects;
|
||||
import net.yacy.server.serverSwitch;
|
||||
import net.yacy.server.servletProperties;
|
||||
|
||||
// http://localhost:8090/api/localpeers.json
|
||||
public class localpeers {
|
||||
|
||||
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, @SuppressWarnings("unused") final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
|
||||
final servletProperties prop = new servletProperties();
|
||||
int c = 0;
|
||||
for (final String urlstub: Switchboard.getSwitchboard().localcluster_scan) {
|
||||
prop.putJSON("peers_" + c + "_urlstub", urlstub); // a usrlstub is a full url with protocol, host and port up the the path start including first "/"
|
||||
c++;
|
||||
}
|
||||
prop.put("peers", c);
|
||||
try {
|
||||
prop.put("status", systemStatus().toString(2));
|
||||
} catch (final JSONException e) {
|
||||
prop.put("status", "");
|
||||
}
|
||||
// return rewrite properties
|
||||
return prop;
|
||||
}
|
||||
|
||||
public static JSONObject systemStatus() throws JSONException {
|
||||
|
||||
// generate json
|
||||
final JSONObject systemStatus = new JSONObject(true);
|
||||
Memory.status().forEach((k, v) -> {try {systemStatus.put(k, v);} catch (final JSONException e) {}});
|
||||
final JSONArray members = new JSONArray();
|
||||
final HazelcastInstance hi = Switchboard.getSwitchboard().localcluster_hazelcast;
|
||||
if (hi != null) {
|
||||
String uuid = hi.getCluster().getLocalMember().getUuid().toString();
|
||||
hi.getMap("status").put(uuid, Memory.status());
|
||||
for (final Member member: hi.getCluster().getMembers()) {
|
||||
final JSONObject m = new JSONObject(true);
|
||||
uuid = member.getUuid().toString();
|
||||
m.put("uuid", uuid);
|
||||
m.put("host", member.getAddress().getHost());
|
||||
try {m.put("ip", member.getAddress().getInetAddress().getHostAddress());} catch (JSONException | UnknownHostException e) {}
|
||||
m.put("port", member.getAddress().getPort());
|
||||
m.put("isLite", member.isLiteMember());
|
||||
m.put("isLocal", member.localMember());
|
||||
@SuppressWarnings("unchecked")
|
||||
final
|
||||
Map<String, Object> status = (Map<String, Object>) hi.getMap("status").get(uuid);
|
||||
m.put("status", status);
|
||||
members.put(m);
|
||||
}
|
||||
systemStatus.put("hazelcast_cluster_name", hi.getConfig().getClusterName());
|
||||
systemStatus.put("hazelcast_instance_name", hi.getConfig().getInstanceName());
|
||||
final Collection<String> interfaces = hi.getConfig().getNetworkConfig().getInterfaces().getInterfaces();
|
||||
systemStatus.put("hazelcast_interfaces", interfaces);
|
||||
systemStatus.put("hazelcast_members", members);
|
||||
systemStatus.put("hazelcast_members_count", members.length());
|
||||
}
|
||||
|
||||
return systemStatus;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"peers" : [#{peers|,}#
|
||||
{"urlstub":"#[urlstub]#"}
|
||||
#{/peers}#],
|
||||
"status": #[status]#
|
||||
}
|
||||
@@ -14,7 +14,6 @@
|
||||
<dependency org="com.drewnoakes" name="metadata-extractor" rev="2.11.0" />
|
||||
<dependency org="com.fasterxml.jackson.core" name="jackson-databind" rev="2.11.2"/>
|
||||
<dependency org="com.google.guava" name="guava" rev="25.1-jre" conf="compile->master"/>
|
||||
<dependency org="com.hazelcast" name="hazelcast" rev="4.2" />
|
||||
<dependency org="com.ibm.icu" name="icu4j" rev="63.1"/>
|
||||
<dependency org="com.jcraft" name="jsch" rev="0.1.54" />
|
||||
<dependency org="com.twelvemonkeys.imageio" name="imageio-core" rev="3.3.2"/>
|
||||
|
||||
@@ -107,12 +107,6 @@ import org.json.JSONTokener;
|
||||
import com.cybozu.labs.langdetect.DetectorFactory;
|
||||
import com.cybozu.labs.langdetect.LangDetectException;
|
||||
import com.google.common.io.Files;
|
||||
import com.hazelcast.config.Config;
|
||||
import com.hazelcast.config.InterfacesConfig;
|
||||
import com.hazelcast.config.JoinConfig;
|
||||
import com.hazelcast.config.NetworkConfig;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
|
||||
import net.yacy.cora.date.AbstractFormatter;
|
||||
import net.yacy.cora.date.GenericFormatter;
|
||||
@@ -311,7 +305,6 @@ public final class Switchboard extends serverSwitch {
|
||||
public LinkedBlockingQueue<String> trail; // connect infos from cytag servlet
|
||||
public SeedDB peers;
|
||||
public Set<String> localcluster_scan;
|
||||
public HazelcastInstance localcluster_hazelcast;
|
||||
public WorkTables tables;
|
||||
public Tray tray;
|
||||
private long lastStats = 0; // time when the last row was written to the stats table
|
||||
@@ -653,23 +646,6 @@ public final class Switchboard extends serverSwitch {
|
||||
}.start();
|
||||
}
|
||||
|
||||
// initialize hazelcast
|
||||
final InterfacesConfig interfacesConfig = new InterfacesConfig();
|
||||
Domains.myIntranetIPs().forEach(ip -> interfacesConfig.addInterface(ip.getHostAddress()));
|
||||
final NetworkConfig networkConfig = new NetworkConfig().setInterfaces(interfacesConfig);
|
||||
final JoinConfig join = networkConfig.getJoin();
|
||||
join.getMulticastConfig().setEnabled(true);
|
||||
final Config config = new Config().setClusterName("YaCyP2P").setInstanceName("Peer").setNetworkConfig(networkConfig);
|
||||
config.getCPSubsystemConfig().setCPMemberCount(3);
|
||||
try {
|
||||
this.localcluster_hazelcast = Hazelcast.newHazelcastInstance(config);
|
||||
final String uuid = this.localcluster_hazelcast.getCluster().getLocalMember().getUuid().toString();
|
||||
this.localcluster_hazelcast.getMap("status").put(uuid, Memory.status());
|
||||
} catch (final Exception e) {
|
||||
this.log.warn(e);
|
||||
this.localcluster_hazelcast = null;
|
||||
}
|
||||
|
||||
// load domainList
|
||||
try {
|
||||
this.domainList = null;
|
||||
|
||||
Reference in new issue
Block a user