LHC native Einrichtung: Unterschied zwischen den Versionen

Aus Planet 3DNow! Distributed Computing Wiki
Zur Navigation springen Zur Suche springen
Zeile 256: Zeile 256:
  
 
= BOINC Client =  
 
= BOINC Client =  
#BOINC anpassen:
+
== BOINC Manager ==
 
#Code:
 
#Code:
  
Zeile 262: Zeile 262:
 
               Address:    squid_hostname_or_IP
 
               Address:    squid_hostname_or_IP
 
               Port:        3128
 
               Port:        3128
 +
 +
== cc_config.xml ==
 +
<proxy_info>
 +
    <http_server_name></http_server_name>
 +
    <http_server_port>3128</http_server_port>
 +
</proxy_info>

Version vom 26. Februar 2021, 21:41 Uhr

Einrichtung von nativen LHC Anwendungen

Diese Anleitung beschreibt die Installation von Squid und Cerns CVMFS auf Ubuntu Systemen. Analog funktioniert dies dann natürlich auch auf Debian, Mint und anderen verwandten Distributionen. Bei SuSE oder RedHat sind die entsprechenden Paketverwaltungstools (zypper/yast & yum/dnf) zu verwenden, auch kann der Squid Nutzer und dessen Gruppe eine andere sein, zB. "squid" anstelle von "proxy".

Squid

Squid ist ein cachender Proxyserver, er wird idR. genutzt um Netzinhalte zu cachen und damit den Zugriff auf diese zu beschleunigen. Damit einher geht eine Reduzierung der notwendigen Netzwerkbandbreite. Es empfiehlt sich ausdrücklich Squid über die distributionseigene Paketverwaltung zu installieren, da diese den Cache automatisch und unterhalb eines eigenen Benutzers startet. Auch Konfgurationen für die automatische Rotation der Squid log files sind enthalten, diese wachsen also nicht ins unermessliche an.

Installation

Cacheverzeichnis anlegen:

   mkdir -p /var/cache/squid

Squid installieren:

   apt install squid

Squid stoppen:

   service squid stop

Cacheverzeichnis dem Squid Benutzer "proxy" übergeben:

   chown -R proxy:proxy /var/cache/squid

Cache Basisstruktur im Cacheverzeichnis anlegen:

   squid -z 

Hier zwei mal Enter drücken, dieser Schritt geht schnell, gibt aber keine newline zurück, scheint daher zu hängen.

Konfiguration

Die eigentliche Konfiguration der Squidcaches erfolg anhand der im LHC Forum abgelegten Konfiguration. Es lohnt sich diesen Thread nochmals zu überfliegen, da Änderungen an der Beispielkonfiguration nicht mehr im Startbeitrag eingepflegt werden können. Stand 26.02.2020 sieht die squid.conf folgendermaßen aus:

# Squid configuration for BOINC
# Based on squid version 3.5
# See also: http://www.squid-cache.org/

# Every line starting with "#" represents a comment.

# Define your local hosts/networks here.
# If neither "crunchers" nor "localnet" is set none of your devices will be permitted to use the proxy.
# The examples show the principle.
# For advanced options read the Squid documentation.
#
# Examples:
#
# Either enter a list of IPs representing your computers that are permitted to use the proxy.
# Each IP on a separate line.
# acl crunchers src 198.51.100.20
# acl crunchers src 198.51.100.31
# acl crunchers src 198.51.100.37
# acl crunchers src 198.51.100.42
#
# Or enter complete network ranges.
# Be aware that this may permit devices like printers or TVs that you may not want to use the proxy.
# acl localnet src 192.0.2.0/24
# acl localnet src 198.51.100.0/24
acl localnet src 192.168.178.0/24


acl SSL_ports port 443
acl Safe_ports port 80
acl Safe_ports port 443
acl Safe_ports port 1025-65535	# unregistered ports

acl CONNECT method CONNECT

follow_x_forwarded_for allow localhost
follow_x_forwarded_for deny all


#
# Start of extra section 1
# Requests that need special handling

# worldcommunitygrid doesn't like it if data is taken from the local cache
acl wcg_nocache dstdomain .worldcommunitygrid.org
cache deny wcg_nocache


# if CVMFS uses geoapi, ensure it's checked directly
acl cvmfs_geoapi urlpath_regex -i ^/+cvmfs/+[0-9a-z._~-]+/+api/+[0-9a-z._~-]+/+geo/+[0-9a-z._~-]+/+[0-9a-z.,_~-]+
cache deny cvmfs_geoapi


# avoids polluting the disk cache with typical onetimers, e.g. ATLAS job data
acl boinc_nocache urlpath_regex -i /download[0-9a-z._~-]*/+[0-9a-z._~-]+/+.+
cache deny boinc_nocache


# seriously: do NOT cache that!
# Based on a frontier cache suggestion
acl PragmaNoCache req_header Pragma no-cache
cache deny PragmaNoCache

# End of extra section 1
#


#
# Start of extra section 2
# parent cache configuration
#
# ATLAS tasks route frontier requests via predefined WLCG proxy chains including load balancing and fail-over.
# The following lines ensure those proxy chains are respected by a local squid as intended by the CERN ATLAS team.

acl request_via_atlasfrontier_chain url_regex -i ^http://+atlasfrontier[1-4]?-ai\.cern\.ch:8000/+[^/]+

cache_peer atlas-db-squid.grid.uio.no parent 3128 0 no-query no-digest weighted-round-robin no-netdb-exchange connect-timeout=7 connect-fail-limit=1
cache_peer_access atlas-db-squid.grid.uio.no allow request_via_atlasfrontier_chain

cache_peer dcache.ijs.si parent 3128 0 no-query no-digest weighted-round-robin no-netdb-exchange connect-timeout=7 connect-fail-limit=1
cache_peer_access dcache.ijs.si allow request_via_atlasfrontier_chain

cache_peer atlasfrontier-ai.cern.ch parent 8000 0 no-query no-digest no-netdb-exchange connect-fail-limit=1
cache_peer_access atlasfrontier-ai.cern.ch allow request_via_atlasfrontier_chain

never_direct allow request_via_atlasfrontier_chain

# End of extra section 2
#

acl Purge method PURGE

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
# Depending on the definition of "crunchers" or "localnet" above at least 1 of the following lines must be uncommented.
# Examples:
# http_access allow crunchers
# http_access allow localnet

http_access allow localhost
# Last "http_access" line.
# Order matters, hence all "http_access" lines following this one will be ignored.
http_access deny all

# http_port
# don't bind it to an IP that is accessible from outside unless you know what you do.
# Examples:
# http_port localhost:3128
#
# This assumes 198.51.100.99 is the external IP of the Squid box
# http_port 198.51.100.99:3128
#
# default setting that binds Squid to all IPs of the Squid box
http_port 3128


# A MUST on Windows.
# If unsure try the the LAN IP of your internet router.
# Avoid using external DNS here.
# On Linux this option shouldn't be necessary
# dns_nameservers 198.51.100.1

max_filedescriptors 4096

# Required OFF for intercepted traffic from LHCb VMs
client_dst_passthru off

# You don't believe this is enough?
# For sure, it is!
cache_mem 256 MB
maximum_object_size_in_memory 24 KB
memory_replacement_policy heap GDSF


# Keep it large enough to store vdi files in the cache.
# See extra section 1 how to avoid onetimers eating up your disk storage.
# min-size=xxx keeps very small files away from your disk
# 20000 limits the disk cache to 20 GB
cache_replacement_policy heap LFUDA
maximum_object_size 6144 MB
cache_dir aufs /var/cache/squid 20000 16 64 min-size=7937

# default=10
logfile_rotate 10

# logformat has to be changed according to your needs and the capabilities of your logfile analyser
logformat my_awstats %>A %lp %ui %un [%tl] "%rm %>ru HTTP/%rv" %>Hs %st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log stdio:/var/log/squid/access.log logformat=my_awstats
#access_log none
strip_query_terms off

coredump_dir none
ftp_user anonymous@

# max_stale 1 week  #default
# extended to be prepared for a project reset
max_stale 37 days

# 1 line is required to avoid the ancient default settings
# be conservative
# don't violate the HTTP standards
refresh_pattern .	0	0%	0

store_avg_object_size 1800 KB

shutdown_lifetime 0 seconds

# booster 1!
collapsed_forwarding on

# booster 2!
client_persistent_connections on
server_persistent_connections on

log_icp_queries off

dns_defnames on
dns_v4_first on

forwarded_for transparent

##### End of squid.conf

Anzupassen ist hier der Parameter acl localnet src 192.168.178.0/24. Dieses ist das LAN-seitige Defaultsubnetz der meisten Fritzboxen. Andere Router nutzen aber zB. das Subnetz 192.168.0.0/24. Alle Rechner dieses Netzwerkes dürfen daraufhin auf den Cache zugreifen. Will man nur einzelne Rechner erlauben, kann dies über Einträge wie acl crunchers src 192.168.178.20 erfolgen, dann wird der Squid seine Services nur dem Rechner mit der IP 192.168.178.20 ermöglichen.

Den Squid nun mit der neuen Konfiguration starten:

   service squid start

Ob der Squid genutzt wird, lässt sich einfach über sein Zugrifflog verfolgen:

   tail -f /var/log/squid/access.log

Startet nach abgeschlossener Konfiguration eine neue native WU, kommen hier innerhalb der ersten Minuten jeweils hunderte bis tausende Einträge hinzu.


CVMFS

CVMFS Installation

CVMFS Konfiguration

  1. CVMFS anpassen:
  2. Code:

vi /etc/cvmfs/default.local

  1. adjust CVMFS_HTTP_PROXY

CVMFS_HTTP_PROXY="http://squid_hostname_or_IP:3128;DIRECT"

  1. squid_hostname_or_IP auf LAN IP des Squidrechners anpassen


  1. Bitte schreib' mal folgende Zeile in die Datei /etc/cvmfs/default.local:

CVMFS_USE_CDN=yes

  1. Nach dem Abspeichern ein "cvmfs_config reload".
  1. Bei "cvmfs_config stat" sollte jetzt "...openhtc.io" statt "cvmfs-stratum-one.cern.ch" in der Ausgabe stehen.

BOINC Client

BOINC Manager

  1. Code:

"Options -> Other Options -> HTTP Proxy"

              Address:     squid_hostname_or_IP
              Port:         3128

cc_config.xml

<proxy_info>

   <http_server_name></http_server_name>
   <http_server_port>3128</http_server_port>

</proxy_info>