- new cluster functions will be available in this menu, but currently not enabled, because corresponding interface methods are not ready yet - shifted remote crawl settings to new network configuration menu - shifted DHT distribution/receive to the new network configuration menu - adopted some string constants - added cluster configuration settings to yacy.init git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3589 6c8d7289-2bf4-0310-a012-ef5d649a1542pull/1/head
parent
c5c3ecc67e
commit
89c1511738
@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>YaCy '#[clientname]#': Network Configuration</title>
|
||||
#%env/templates/metas.template%#
|
||||
</head>
|
||||
<body id="ConfigNetwork">
|
||||
#%env/templates/header.template%#
|
||||
#%env/templates/submenuConfig.template%#
|
||||
<h2>Network Configuration</h2>
|
||||
#(commit)#
|
||||
::<div class="commit">Accepted Changes.</div>
|
||||
::<div class="error">Inapplicable Setting Combination:</div>
|
||||
#(/commit)#
|
||||
#(commitCrawlPlea)#::<div class="error">P2P operation can run without remote indexing, but runs better with remote indexing switched on. Please switch 'Accept Remote Crawl Requests' on.</div>#(/commitCrawlPlea)#
|
||||
#(commitDHTIsRobinson)#::<div class="error">For P2P operation, at least DHT distribution or DHT receive (or both) must be set. You have thus defined a Robinson configuration.</div>#(/commitDHTIsRobinson)#
|
||||
#(commitDHTNoGlobalSearch)#::<div class="error">Global Search in P2P configuration is only allowed, if both, index receive and distribution is switched on. You have a P2P configuration, but are not allowed to search other peers.</div>#(/commitDHTNoGlobalSearch)#
|
||||
#(commitRobinson)#::<div class="commit">For Robinson Mode, index distribution and receive is switched off.</div>#(/commitRobinson)#
|
||||
#(commitRobinsonWithRemoteIndexing)#::<div class="commit">This Robinson Mode switches remote indexing on, but limits targets to peers within the same cluster. Remote indexing requests from peers within the same cluster are accepted.</div>#(/commitRobinsonWithRemoteIndexing)#
|
||||
#(commitRobinsonWithoutRemoteIndexing)#::<div class="commit">This Robinson Mode does not allow any remote indexing (neither requests nor acceptance of other requests).</div>#(/commitRobinsonWithoutRemoteIndexing)#
|
||||
<p>
|
||||
You can configure if you want to participate at the global YaCy network or if you want to have your
|
||||
own separate search cluster with or without connection to the global network. You may also define
|
||||
a completely independent search engine instance, without any data exchange between your peer and other
|
||||
peers, which we call a 'Robinson' peer.
|
||||
</p>
|
||||
<form method="post" action="ConfigNetwork_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<fieldset>
|
||||
<legend><input type="radio" name="network" id="p2p" value="p2p"#(p2p.checked)#:: checked="checked"#(/p2p.checked)# />Peer-to-Peer Mode</legend>
|
||||
<dl>
|
||||
<dt>Index Distribution <input type="checkbox" name="indexDistribute" #(indexDistributeChecked)#::checked="checked" #(/indexDistributeChecked)#/></dt>
|
||||
<dd>
|
||||
This enables automated, DHT-ruled Index Transmission to other peers.<br>
|
||||
<input type="radio" value="on" name="indexDistributeWhileCrawling" #(indexDistributeWhileCrawling.on)#::checked="checked" #(/indexDistributeWhileCrawling.on)#/> enabled
|
||||
/
|
||||
<input type="radio" value="off" name="indexDistributeWhileCrawling" #(indexDistributeWhileCrawling.off)#::checked="checked" #(/indexDistributeWhileCrawling.off)#/> disabled
|
||||
during crawling.
|
||||
</dd>
|
||||
<dt>Index Receive <input type="checkbox" name="indexReceive" #(indexReceiveChecked)#::checked="checked" #(/indexReceiveChecked)#::/></dt>
|
||||
<dd>
|
||||
Accept remote Index Transmissions.<br>This works only if you have a senior peer. The DHT-rules do not work without this function.<br>
|
||||
<input type="radio" value="on" name="indexReceiveBlockBlacklist" #(indexReceiveBlockBlacklistChecked.on)#::checked="checked" #(/indexReceiveBlockBlacklistChecked.on)#/> reject
|
||||
/
|
||||
<input type="radio" value="off" name="indexReceiveBlockBlacklist" #(indexReceiveBlockBlacklistChecked.off)#::checked="checked" #(/indexReceiveBlockBlacklistChecked.off)#/> accept
|
||||
transmitted URLs that match your blacklist
|
||||
</dd>
|
||||
<dt>Accept Remote Crawl Requests <input type="checkbox" name="crawlResponse" #(crawlResponse)#::checked="checked" #(/crawlResponse)#::/></dt>
|
||||
<dd>
|
||||
Perform web indexing upon request of another peer.<br>This works only if you are a senior peer.<br>
|
||||
Load with a maximum of <input name="acceptCrawlLimit" type="text" size="3" maxlength="3" value="#[acceptCrawlLimit]#" /> pages per minute
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend><input type="radio" name="network" id="robinson" value="robinson"#(robinson.checked)#:: checked="checked"#(/robinson.checked)# />Robinson Mode</legend>
|
||||
<p class="help">
|
||||
If your peer runs in 'Robinson Mode' you run YaCy as a search engine for your own search portal without data exchange to other peers.
|
||||
There is no index receive and no index distribution between your peer and any other peer.
|
||||
In case of Robinson-clustering there can be acceptance of remote crawl requests from peers of that cluster.
|
||||
</p>
|
||||
<dl>
|
||||
<dt>Private Peer<input type="radio" value="privatepeer" name="cluster.mode" #(privatepeerChecked)#::checked="checked" #(/privatepeerChecked)#/></dt>
|
||||
<dd>Your search engine will not contact any other peer, and will reject every request.
|
||||
</dd>
|
||||
<!-- not yet implemented
|
||||
<dt>Private Cluster<input type="radio" value="privatecluster" name="cluster.mode" #(privateclusterChecked)#::checked="checked" #(/privateclusterChecked)#/></dt>
|
||||
<dd>Your peer is part of a private cluster without public visibility.<br>
|
||||
Index data is not distributed, but remote crawl requests are distributed and accepted from your cluster.<br>
|
||||
Search requests are spread over all peers of the cluster, and answered from all peers of the cluster.
|
||||
</dd>
|
||||
<dt>Public Cluster<input type="radio" value="publiccluster" name="cluster.mode" #(publicclusterChecked)#::checked="checked" #(/publicclusterChecked)#/></dt>
|
||||
<dd>Your peer is part of a public cluster within the YaCy network.<br>
|
||||
Index data is not distributed, but remote crawl requests are distributed and accepted<br>
|
||||
Search requests are spread over all peers of the cluster, and answered from all peers of the cluster.<br>
|
||||
List of ip:port - addresses of the cluster: (comma-separated)<br>
|
||||
<input type="text" name="cluster.peers.ipport" value="#[cluster.peers.ipport]#" size="80" maxlength="800" />
|
||||
</dd>
|
||||
-->
|
||||
<dt>Public Peer<input type="radio" value="publicpeer" name="cluster.mode" #(publicpeerChecked)#::checked="checked" #(/publicpeerChecked)#/></dt>
|
||||
<dd>You are visible to other peers and contact them to distribute your presence.<br>
|
||||
Your peer does not accept any outside index data, but responds on all remote search requests.<br>
|
||||
List of .yacy or .yacyh - domains of the cluster: (comma-separated)<br>
|
||||
<input type="text" name="cluster.peers.yacydomain" value="#[cluster.peers.yacydomain]#" size="80" maxlength="800" />
|
||||
</dd>
|
||||
<dt>Peer Tags</dt>
|
||||
<dd>When you allow access from the YaCy network, your data is recognized using keywords.<br>
|
||||
Please describe your search portal with some keywords (comma-separated).<br>
|
||||
<input type="text" name="peertags" value="#[peertags]#" size="40" maxlength="80" />
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<input type="submit" name="save" value="Save" />
|
||||
|
||||
</form>
|
||||
#%env/templates/footer.template%#
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,191 @@
|
||||
// ConfigNetwork_p.java
|
||||
// --------------------
|
||||
// (C) 2007 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
|
||||
// first published 20.04.2007 on http://yacy.net
|
||||
//
|
||||
// This is a part of YaCy, a peer-to-peer based web search engine
|
||||
//
|
||||
// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
|
||||
// $LastChangedRevision: 1986 $
|
||||
// $LastChangedBy: orbiter $
|
||||
//
|
||||
// LICENSE
|
||||
//
|
||||
// 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 de.anomic.http.httpHeader;
|
||||
import de.anomic.plasma.plasmaSwitchboard;
|
||||
import de.anomic.server.serverCodings;
|
||||
import de.anomic.server.serverObjects;
|
||||
import de.anomic.server.serverSwitch;
|
||||
import de.anomic.server.serverThread;
|
||||
import de.anomic.yacy.yacyCore;
|
||||
|
||||
public class ConfigNetwork_p {
|
||||
|
||||
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
|
||||
|
||||
plasmaSwitchboard sb = (plasmaSwitchboard) env;
|
||||
serverObjects prop = new serverObjects();
|
||||
int commit = 0;
|
||||
|
||||
if (post != null) {
|
||||
|
||||
boolean crawlResponse = post.get("crawlResponse", "off").equals("on");
|
||||
|
||||
// DHT control
|
||||
boolean indexDistribute = post.get("indexDistribute", "").equals("on");
|
||||
boolean indexReceive = post.get("indexReceive", "").equals("on");
|
||||
boolean robinsonmode = post.get("network", "").equals("robinson");
|
||||
String clustermode = post.get("cluster.mode", "publicpeer");
|
||||
if (robinsonmode) {
|
||||
indexDistribute = false;
|
||||
indexReceive = false;
|
||||
if ((clustermode.equals("privatepeer")) || (clustermode.equals("publicpeer"))) {
|
||||
prop.put("commitRobinsonWithoutRemoteIndexing", 1);
|
||||
crawlResponse = false;
|
||||
}
|
||||
if ((clustermode.equals("privatecluster")) || (clustermode.equals("publiccluster"))) {
|
||||
prop.put("commitRobinsonWithRemoteIndexing", 1);
|
||||
crawlResponse = true;
|
||||
}
|
||||
commit = 1;
|
||||
} else {
|
||||
if (!indexDistribute && !indexReceive) {
|
||||
prop.put("commitDHTIsRobinson", 1);
|
||||
commit = 2;
|
||||
} else if (indexDistribute && indexReceive) {
|
||||
commit = 1;
|
||||
} else {
|
||||
prop.put("commitDHTNoGlobalSearch", 1);
|
||||
commit = 1;
|
||||
}
|
||||
if (!crawlResponse) {
|
||||
prop.put("commitCrawlPlea", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (indexDistribute) {
|
||||
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true");
|
||||
} else {
|
||||
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "false");
|
||||
}
|
||||
|
||||
if (post.get("indexDistributeWhileCrawling","").equals("on")) {
|
||||
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true");
|
||||
} else {
|
||||
sb.setConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "false");
|
||||
}
|
||||
|
||||
if (indexReceive) {
|
||||
sb.setConfig("allowReceiveIndex", "true");
|
||||
yacyCore.seedDB.mySeed.setFlagAcceptRemoteIndex(true);
|
||||
} else {
|
||||
sb.setConfig("allowReceiveIndex", "false");
|
||||
yacyCore.seedDB.mySeed.setFlagAcceptRemoteIndex(false);
|
||||
}
|
||||
|
||||
if (post.get("indexReceiveBlockBlacklist", "").equals("on")) {
|
||||
sb.setConfig("indexReceiveBlockBlacklist", "true");
|
||||
} else {
|
||||
sb.setConfig("indexReceiveBlockBlacklist", "false");
|
||||
}
|
||||
|
||||
if (post.containsKey("peertags")) {
|
||||
yacyCore.seedDB.mySeed.setPeerTags(serverCodings.string2set(normalizedList((String) post.get("peertags")), ","));
|
||||
}
|
||||
|
||||
sb.setConfig("cluster.mode", post.get("cluster.mode", "publicpeer"));
|
||||
|
||||
// read remote crawl request settings
|
||||
sb.setConfig("crawlResponse", (crawlResponse) ? "true" : "false");
|
||||
int newppm = Math.max(1, Integer.parseInt(post.get("acceptCrawlLimit", "1")));
|
||||
long newBusySleep = Math.max(100, 60000 / newppm);
|
||||
serverThread rct = sb.getThread(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
|
||||
rct.setBusySleep(newBusySleep);
|
||||
sb.setConfig(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, Long.toString(newBusySleep));
|
||||
|
||||
sb.setConfig("cluster.peers.ipport", checkIPPortList(post.get("cluster.peers.ipport", "")));
|
||||
sb.setConfig("cluster.peers.yacydomain", checkYaCyDomainList(post.get("cluster.peers.yacydomain", "")));
|
||||
|
||||
}
|
||||
|
||||
// write answer code
|
||||
prop.put("commit", commit);
|
||||
|
||||
// write remote crawl request settings
|
||||
prop.put("crawlResponse", sb.getConfigBool("crawlResponse", false) ? 1 : 0);
|
||||
long RTCbusySleep = Integer.parseInt(env.getConfig(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL_BUSYSLEEP, "100"));
|
||||
int RTCppm = (int) (60000L / RTCbusySleep);
|
||||
prop.put("acceptCrawlLimit", RTCppm);
|
||||
|
||||
boolean indexDistribute = sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW, "true").equals("true");
|
||||
boolean indexReceive = sb.getConfig("allowReceiveIndex", "true").equals("true");
|
||||
prop.put("indexDistributeChecked", (indexDistribute) ? 1 : 0);
|
||||
prop.put("indexDistributeWhileCrawling.on", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? 1 : 0);
|
||||
prop.put("indexDistributeWhileCrawling.off", (sb.getConfig(plasmaSwitchboard.INDEX_DIST_ALLOW_WHILE_CRAWLING, "true").equals("true")) ? 0 : 1);
|
||||
prop.put("indexReceiveChecked", (indexReceive) ? 1 : 0);
|
||||
prop.put("indexReceiveBlockBlacklistChecked.on", (sb.getConfig("indexReceiveBlockBlacklist", "true").equals("true")) ? 1 : 0);
|
||||
prop.put("indexReceiveBlockBlacklistChecked.off", (sb.getConfig("indexReceiveBlockBlacklist", "true").equals("true")) ? 0 : 1);
|
||||
prop.put("peertags", serverCodings.set2string(yacyCore.seedDB.mySeed.getPeerTags(), ",", false));
|
||||
|
||||
// set seed information directly
|
||||
yacyCore.seedDB.mySeed.setFlagAcceptRemoteCrawl(sb.getConfigBool("crawlResponse", false));
|
||||
yacyCore.seedDB.mySeed.setFlagAcceptRemoteIndex(indexReceive);
|
||||
|
||||
// set p2p/robinson mode flags and values
|
||||
prop.put("p2p.checked", (indexDistribute || indexReceive) ? 1 : 0);
|
||||
prop.put("robinson.checked", (indexDistribute || indexReceive) ? 0 : 1);
|
||||
prop.put("cluster.peers.ipport", sb.getConfig("cluster.peers.ipport", ""));
|
||||
prop.put("cluster.peers.yacydomain", sb.getConfig("cluster.peers.yacydomain", ""));
|
||||
|
||||
// set p2p mode flags
|
||||
prop.put("privatepeerChecked", (sb.getConfig("cluster.mode", "").equals("privatepeer")) ? 1 : 0);
|
||||
prop.put("privateclusterChecked", (sb.getConfig("cluster.mode", "").equals("privatecluster")) ? 1 : 0);
|
||||
prop.put("publicclusterChecked", (sb.getConfig("cluster.mode", "").equals("publiccluster")) ? 1 : 0);
|
||||
prop.put("publicpeerChecked", (sb.getConfig("cluster.mode", "").equals("publicpeer")) ? 1 : 0);
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
public static String normalizedList(String input) {
|
||||
input = input.replace(' ', ',');
|
||||
input = input.replace(' ', ';');
|
||||
input = input.replaceAll(",,", ",");
|
||||
if (input.startsWith(",")) input = input.substring(1);
|
||||
if (input.endsWith(",")) input = input.substring(0, input.length() - 1);
|
||||
return input;
|
||||
}
|
||||
|
||||
public static String checkYaCyDomainList(String input) {
|
||||
input = normalizedList(input);
|
||||
String[] s = input.split(",");
|
||||
input = "";
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
if ((s[i].endsWith(".yacyh")) || (s[i].endsWith(".yacy"))) input += "," + s[i];
|
||||
}
|
||||
if (input.length() == 0) return input; else return input.substring(1);
|
||||
}
|
||||
|
||||
public static String checkIPPortList(String input) {
|
||||
input = normalizedList(input);
|
||||
String[] s = input.split(",");
|
||||
input = "";
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
if (s[i].indexOf(':') >= 9) input += "," + s[i];
|
||||
}
|
||||
if (input.length() == 0) return input; else return input.substring(1);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue