我正在尝试与Google Kubernetes建立集群。
我需要使用sphinxsearch并创建一个动态解决方案以通过负载使用来增加VM。
我的Docker文件是:
FROM centos:latest
COPY sources/boot.sh /boot.sh
COPY sources/sphinx.conf /sphinx.conf
COPY sources/*******.json /******.json
RUN yum -y update && yum install -y wget mysql-devel && \
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O /cloud_sql_proxy && \
chmod +x cloud_sql_proxy && chmod +x boot.sh
EXPOSE 9312
EXPOSE 9306
ENTRYPOINT ./boot.sh
我的boot.sh是:
#!/usr/bin/env bash
ldconfig
nohup /cloud_sql_proxy -instances=my_istance_tcp:3306 -credential_file=/my_file.json &
wget http://sphinxsearch.com/files/sphinx-3.0.3-facc3fb-linux-amd64-glibc2.12.tar.gz
tar -zxvf sphinx-3.0.3-facc3fb-linux-amd64-glibc2.12.tar.gz
mv sphinx-3.0.3/bin/* /usr/bin/
mkdir -p /var/log/sphinxsearch
touch /var/log/sphinxsearch/searchd.log && touch /var/log/sphinxsearch/query.log
mkdir -p /var/lib/sphinxsearch/data
indexer --rotate --all --config sphinx.conf
searchd --config sphinx.conf --nodetach
在具有docker run
的PC上,我可以连接到127.0.0.1:9312/9306
,但是当我将其部署到群集中时,会收到:
telnet 104.19.****** 9312
Trying 104.19.******...
telnet: connect to address 104.19.******: Connection refused
telnet: Unable to connect to remote host
YAML文件:
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2018-11-08T16:28:45Z
labels:
app: nginx-1
name: nginx-1-service
namespace: default
resourceVersion: "722"
selfLink: /api/v1/namespaces/default/services/nginx-1-service
uid: 5d3e48b8-e373-11e8-9c04-42010a80030e
spec:
clusterIP: 10.51.*****
externalTrafficPolicy: Cluster
ports:
- name: 9312-to-9312-tcp
nodePort: 30249
port: 9312
protocol: TCP
targetPort: 9312
- name: 9306-to-9306-tcp
nodePort: 32527
port: 9306
protocol: TCP
targetPort: 9306
selector:
app: nginx-1
sessionAffinity: None
type: LoadBalancer
status:
loadBalancer:
ingress:
- ip: 104.19.**********
你能帮我吗?
谢谢!