Outils pour utilisateurs

Outils du site


blog

Notes - Systeme de fichiers - FAT VFAT exFAT

Détecter le type de FAT

(sectors per track)

file -s /dev/partition

ou encore (avec le paquet mtools)

minfo -i /dev/partition
2025/03/24 15:06

Apache solr lucene

Voir :

Solr utilise le langage Java et est exécuté par un conteneur de servlets1, comme Tomcat, jusqu'à la version 5.0 puis devient un standalone Java.

Solr Instance : Ir refers to Solr server running inside JVM Solr Core : In Solr, the term “core” is used to refer to a single index and confoguration files (such as solrconfig.xml, schema files etc!…) and transaction log associated with code. You can have one or more cores (indexes) running inside single Solr instance. Physically each core maps to a subdirectory in the Solr home directory

tar xvf solr-7.5.0.tgz
cd solr-7.5.0
 
# See solr-7.5.0/README.txt
bin/solr start -help

Deux modes :

  • standalone (core)
  • SolrCloud mode (collection)
Start
# standalone (core)
bin/solr start
 
# SolrCloud mode (collection)
bin/solr start -cloud

http://localhost:8983/solr

Cloudtab http://localhost:8983/solr/#/~cloud

Create

Creation d'un core

bin/solr create -c techproducts
bin/post -c techproducts example/exampledocs/books.csv

Requette

http://localhost:8983/solr/techproducts/select?q=*:*
Diag
bin/solr status

Les logs sont ici : ./server/logs/

Check / supervision Voir https://lucene.apache.org/solr/guide/7_5/ping.html

#curl http://localhost:8983/solr/techproducts/admin/ping
curl -i -H "Accept: application/json" 'http://localhost:8983/solr/techproducts/admin/ping
Stop & clean

Stop

bin/solr stop -all

Clean

rm -rf server/solr/techproducts/

Autres

cd solr-7.5.0/server
mkdir plop
cd plop
mkdir conf
mkdir data
touch core.properties
touch conf/schema.xml
touch conf/solrconfig.xml
Install Solr tomcat (anciennes versions)

Voir https://github.com/sunspot/sunspot/wiki/Configure-Solr-on-Ubuntu,-the-quickest-way

apt-get install openjdk-6-jdk
apt-get install solr-tomcat

Vérif

ps -ef |grep java
curl http://localhost:8080/solr/admin/ping |egrep 'str name="status.*OK'
Notes - starts

Pour les versions anciennes

java -jar start.jar

Avec la version 7.5 en faisant un ps -ef |grep java

java -server -Xms512m -Xmx512m -XX:NewRatio=3 -XX:SurvivorRatio=4 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=8 -XX:+UseConcMarkSweepGC -XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 -XX:+CMSScavengeBeforeRemark -XX:PretenureSizeThreshold=64m -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=50 -XX:CMSMaxAbortablePrecleanTime=6000 -XX:+CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:-OmitStackTraceInFastThrow -verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:/tmp/plop/solr-7.5.0/server/logs/solr_gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=9 -XX:GCLogFileSize=20M -Dsolr.log.dir=/tmp/plop/solr-7.5.0/server/logs -Djetty.port=8983 -DSTOP.PORT=7983 -DSTOP.KEY=solrrocks -Duser.timezone=UTC -Djetty.home=/tmp/plop/solr-7.5.0/server -Dsolr.solr.home=/tmp/plop/solr-7.5.0/server/solr -Dsolr.data.home= -Dsolr.install.dir=/tmp/plop/solr-7.5.0 -Dsolr.default.confdir=/tmp/plop/solr-7.5.0/server/solr/configsets/_default/conf -Xss256k -Dsolr.jetty.https.port=8983 -Dsolr.log.muteconsole -XX:OnOutOfMemoryError=/tmp/plop/solr-7.5.0/bin/oom_solr.sh 8983 /tmp/plop/solr-7.5.0/server/logs -jar start.jar --module=http
2025/03/24 15:06

Notes - routage statique

AWS RedHat

/etc/sysconfig/network-scripts/route-eth0

10.0.0.0/8    via 10.240.122.1 dev eth0

/etc/sysconfig/network-scripts/ec2net-functions

#DEFROUTE=no

/etc/sysconfig/network-scripts/ifcfg-eth1

#DEFROUTE=no

Paquets sur la même interface

I want packets to leave the same interface they came in.

Nommer les nouvelles tables

echo "100	net0" >> /etc/iproute2/rt_table
echo "101	net1" >> /etc/iproute2/rt_table

/etc/sysconfig/network-scripts/route-eth0

10.0.0.0/8 via 10.240.122.1 dev eth0 table net0

/etc/sysconfig/network-scripts/route-eth1

10.0.0.0/8 via 10.240.123.1 dev eth1 table net1

/etc/sysconfig/network-scripts/rule-eth0

#iff lo table net0
iif eth0 table net0
from 10.240.122.223 table net0

Ici 10.240.122.223 est l'adresse IP de eth0

/etc/sysconfig/network-scripts/rule-eth1

iif eth1 table net1
from 10.240.123.30 table net1

10.240.123.30 est l'adresse IP de eth1

Appliquer la conf

#ip route flush cache
 
#ip route flush table net0
#ip route flush table net1
 
systemctl restart network

Debian

Source : https://blog.bluemalkin.net/multiple-ips-and-enis-on-ec2-in-a-vpc/

echo "101	eth1_rt" >> /etc/iproute2/rt_table

/etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback
 
# The primary network interface
auto eth0
iface eth0 inet dhcp
 
# The second network interface
auto eth1
iface eth1 inet static
    address 10.0.2.10
    netmask 255.255.255.0
    network 10.0.2.0
    broadcast 10.0.2.255
    up ip route add default via 10.0.2.1 dev eth1 table eth1_rt
    up ip rule add from 10.0.2.0/24 lookup eth1_rt prio 1000

Commande ip iproute2

man ip-route
man ip-rule

Pb

Err argument "lock" is wrong
# ip route show default
default via 192.168.1.1 dev ens4 proto dhcp src 192.168.1.190 metric 100 rto_min lock 8ms
default via 192.168.1.1 dev ens4 proto dhcp src 192.168.1.190 metric 100

# ip route delete default via 192.168.1.1 dev ens4 proto dhcp src 192.168.1.190 metric 100 rto_min lock 8ms
Error: argument "lock" is wrong: "rto_min" value is invalid
Solution

Rappeler la commande sans le paramètre lock

ip route delete default via 192.168.1.1 dev ens4 proto dhcp src 192.168.1.190 metric 100 rto_min 8ms

Voir aussi : ip route replace

2025/03/24 15:06

Notes - Python - Static type code analyzer

Et annotations de fonctions

pytype

pip install --user pytype

plop.py

#! /usr/bin/env python3
 
def func(a: int, b: int, c: int) -> int:
    return a + b + c
 
print(func(1, 2, 3.7))
$ pytype-single plop.py 
File "plop.py", line 6, in <module>: Function func was called with the wrong arguments [wrong-arg-types]
         Expected: (a, b, c: int)
  Actually passed: (a, b, c: float)

For more details, see https://google.github.io/pytype/errors.html#wrong-arg-types
(python-dev-test) jibe@vivobela:~/code/python-dev-test$ pytype plop.py 
Computing dependencies
Analyzing 1 sources with 0 local dependencies
ninja: Entering directory `.pytype'
[1/1] check plop
merge-pyi

plop.py

#! /usr/bin/env python3
 
 
def func(a, b, c):
    return a + b + c
 
 
print(func(1, 2, 3.7))
pytype plop.py

.pytype/pyi/plop.pyi

# (generated with --quick)
 
from typing import Any
 
def func(a, b, c) -> Any: ...
vim .pytype/pyi/plop.pyi

.pytype/pyi/plop.pyi

# def func(a, b, c) -> Any: ...
def func(a: int, b: int, c: int) -> int: ...
merge-pyi -i plop.py .pytype/pyi/plop.pyi 

plop.py

#! /usr/bin/env python3
 
 
def func(a: int, b: int, c: int) -> int:
    return a + b + c
 
 
print(func(1, 2, 3.7))

Mypy

$ mypy plop.py 
plop.py:6: error: Argument 3 to "func" has incompatible type "float"; expected "int"  [arg-type]
Found 1 error in 1 file (checked 1 source file)
2025/03/24 15:06

Notes - Kubernetes - K8S

Bonnes pratiques

Évitez les Pods orphelins (“Naked” Pods) les pods dits “orphelins” sont ceux qui ne sont pas liés à un contrôleur de plus haut niveau (ReplicaSets, Deployments, …). Comme ils ne sont pas managés, ils ne seront pas relancés en cas d'erreur ou d'échec du nœud.

Spécifiez le namespace par défaut

kubectl config set-context --current --namespace=working-namespace

Ou utiliser kubectx / kubens

Storage

2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki