Add network tc & mariadb examples

This commit is contained in:
Super User
2024-06-19 18:51:22 +03:00
parent eaa2d11891
commit c1f28f3ba9
2 changed files with 35 additions and 1 deletions

View File

@@ -15,3 +15,33 @@ iptables -L -vn
# Fix TTL for mobile network # Fix TTL for mobile network
iptables -t mangle -A POSTROUTING -j TTL --ttl-set 65 iptables -t mangle -A POSTROUTING -j TTL --ttl-set 65
``` ```
## TC
```bash
#!/bin/bash
interface=veth0
interface_limit=100mbit
download_limit=40mbit
upload_limit=40mbit
# tc -s -d qdisc show dev veth0
tc qdisc show dev $interface | grep -q "qdisc pfifo_fast 0"
[ "$?" -gt "0" ] && tc qdisc del dev $interface root; sleep 1
tc qdisc add dev $interface root handle 1: htb default 30
tc class add dev $interface parent 1: classid 1:1 htb rate $interface_limit burst 15k
tc class add dev $interface parent 1:1 classid 1:10 htb rate $download_limit burst 15k
tc class add dev $interface parent 1:1 classid 1:20 htb rate $upload_limit burst 15k
tc qdisc add dev $interface parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $interface parent 1:20 handle 20: sfq perturb 10
tc filter add dev $interface protocol ip parent 1: prio 1 u32 match ip dst 0.0.0.0/0 flowid 1:10
tc filter add dev $interface protocol ip parent 1: prio 1 u32 match ip src 0.0.0.0/0 flowid 1:20
```

View File

@@ -16,5 +16,9 @@ done
## Append field in table ## Append field in table
```sql ```sql
ALTER TABLE existsTableName ADD COLUMN `newFieldName` varchar(64) NOT NULL DEFAULT ''; CREATE TABLE tableName_new AS (SELECT * FROM tableName);
ALTER TABLE tableName_new ADD COLUMN `newFieldName` varchar(64) NOT NULL DEFAULT '' AFTER `existFieldName`;
RENAME TABLE tableName TO tableName_old; RENAME TABLE tableName_new TO tableName;
``` ```